Open rayguang opened 3 years ago
Have you checked this version of minio storage provider ? https://github.com/rayguang/ray_vott/blob/master/src/providers/storage/minioStorage.ts
The above link is authored by me :-)
I finally got it working by using the browserify. I am not a Javascript programmer but did some research to figure this out. I will publish what I have done once all code are finalized.
Ok, fine. I am interested!
Describe the bug I am adding a new cloud storage support by using min.io (https://docs.min.io/docs/javascript-client-api-reference.html). After running npm start, no particular error. When I go to http://localhost, received the following error:
`ReferenceError: require is not defined Module../node_modules/minio/node_modules/async/dist/async.mjs http://localhost/static/js/0.chunk.js:215453:30 __webpack_require__ src/app/webpack/bootstrap:782 779 | }; 780 | 781 | // Execute the module function
To Reproduce I have created several files and made most changes in minioStorage.ts by replacing the functions similar to azureStorage.ts with minio API
Expected behavior A clear and concise description of what you expected to happen. A sample of the code listed below:
`import { IStorageProvider } from "./storageProviderFactory"; import { IAsset, AssetType, StorageType } from "../../models/applicationState"; import { AssetService } from "../../services/assetService"; import * as minio from "minio"; import { Bounce } from "react-toastify";
//var minio = require("minio");
const minioClient = new minio.Client({ endPoint: "localhost", port: 9000, useSSL: false, accessKey: "xxxx", secretKey: "xxxxxxx" });
/**
export class MinioStorage implements IStorageProvider { /**
@returns - StorageType.Cloud */ public storageType: StorageType = StorageType.Cloud;
constructor(private options?: IMinioStorageOptions) {}
/**
createBucket
was specified in options, this functionconnect to Minio Storage */ public async initialize(): Promise {
const bucketName = this.options.folderName;
if (this.options.createFolder) {
await this.createContainer(bucketName);
} else {
const containers = await this.listFiles(bucketName);
if (containers.length === 0) {
throw new Error(
Container "${bucketName}" does not exist
); } } }/**
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context Add any other context about the problem here.