1.0.1 • Published 11 months ago

@barryuse/miniojs v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

MinioJS

minio的官方客户端使用时必须依赖node.js, 无法在VUE及html项目中使用, 此项目把minio的使用打包为纯js,可以在浏览器中直接调用minio的客户端

初始化参数参见官方文档

https://min.io/docs/minio/linux/developers/javascript/API.html

安装

npm install @barryuse/miniojs

CDN引入方式使用

//引入
<script type="text/javascript" src="<%= BASE_URL %>vendor/MinioJs.js"></script>
//初始化
MinioJs.initMinio({
	endPoint: 'xxxx',
	port: 443,
	useSSL: true,
	accessKey: 'xxxx',
	secretKey: 'xxxx'
});
//上传
const bucket = 'xxx'
const fileName = 'xxxx'
const fileStream = await MinioJs.getTargetFileStream(file)
MinioJs.putObject(bucket, fileName, fileStream, function (err, objInfo) {
	if (err) {
		return console.error(err, 'error')
	}
	console.log(objInfo, 'success')
});

在VUE项目中使用

--编写中--

1.0.1

11 months ago

1.0.0

11 months ago