Skip to content

CodeMonkeyLuffy/qiniu-web-uploader

 
 

Repository files navigation

七牛上传模块NPM version NPM downloads MIT License

##功能

  • 七牛分片上传

NPM

npm i qiniu-web-uploader

使用

import Uploader from 'qiniu-web-uploader';

/*
uptoken:
{
  uptoken: 'asdfsdf', //七牛上传凭证
  key: 'sdfa' //base64字符串,new Buffer(key).toString('base64')
}
*/
let uploader = new Uploader(file, uptoken);

uploader.on('progress', () => {
  console.log(uploader.percent); //加载进度
  console.log(uploader.offset); //字节
  console.log(uploader.file); //文件
});
uploader.on('cancel', () => {
  //取消
});
uploader.on('complete', () => {
  console.log(uploader.imgRes); //文件
});

let imgRes = await uploader.upload(); //返回七牛返回的Key
uploader.cancel(); //取消

About

七牛上传模块

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.3%
  • HTML 3.7%