{ | ||
"name": "minio-js", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "minioclient", | ||
"main": "main/MinioJs.js", | ||
"main": "dist/minio-js.js", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "test": "echo \"Error: no test specified\" && exit 1", |
@@ -0,1 +1,4 @@ | ||
export const Minio = require("minio"); | ||
let MinioConfig = null; | ||
@@ -13,17 +16,19 @@ | ||
//封装的上传到minio | ||
export function putObject(bucketName, file, fileName) { | ||
export function putObject(bucketName, file, fileName, callback) { | ||
if (!MinioConfig) { | ||
throw new Error("请先初始化Minio"); | ||
} | ||
console.log("MinioJs.putObject:"); | ||
console.log(file); | ||
console.log("MinioJs.putObject"); | ||
let buf = Buffer.from(file); //Buffer | ||
var Minio = require("minio"); | ||
var minioClient = new Minio.Client(MinioConfig); | ||
minioClient.putObject(bucketName, fileName, buf, function (err, data) { | ||
if (err) console.log(err); | ||
else console.log("Successfully uploaded data to testbucket/testobject"); | ||
}); | ||
minioClient.putObject(bucketName, fileName, buf, callback | ||
// function (err, data) { | ||
// if (err) console.log(err); | ||
// else console.log("Successfully uploaded data to testbucket/testobject"); | ||
// } | ||
); | ||
} | ||
//测试用 | ||
@@ -30,0 +35,0 @@ function putObjectTest(bucketName, file, fileName) { |
@@ -9,6 +9,6 @@ const path = require("path"); | ||
path: path.resolve(__dirname, "dist"), | ||
filename: "MinioJs.js", | ||
filename: "minio-js.js", | ||
libraryTarget: "umd", | ||
globalObject: "this", | ||
library: "MinioJs", | ||
library: "minio-js", | ||
}, | ||
@@ -15,0 +15,0 @@ plugins: [new NodePolyfillPlugin()], |
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
1007307
064
3.23%