qiniu-web-uploader
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "qiniu-web-uploader", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "七牛上传模块", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -15,8 +15,26 @@ # 七牛上传模块[![Build Status](https://travis-ci.org/conglai/qiniu-web-uploader.svg?branch=master)](https://travis-ci.org/conglai/qiniu-web-uploader) | ||
```js | ||
import { UploaderQueue } from 'qiniu-web-uploader'; | ||
import Uploader from 'qiniu-web-uploader'; | ||
let queue = new UplUploaderQueue(); | ||
queue.push(file, uptoken); // file为input,只能压缩图片,uptoken为七牛上传凭证 | ||
/* | ||
{ | ||
uptoken: 'asdfsdf', //七牛上传凭证 | ||
key: 'sdfa' //base63字符串 | ||
} | ||
*/ | ||
let uploader = new Uploader(file, uptoken); | ||
queue.runUpload() | ||
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(); //取消 | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15347
40
0