🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

minio-js

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minio-js - npm Package Compare versions

Comparing version

to
1.0.7

{
"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()],