Skip to content

Commit 2086bd3

Browse files
binghaiwangPeterRao
authored andcommitted
feat: add options doc and multipart options-progress doc (#370)
* feat: add options doc and multipart options-progress doc * feat: change stsToken link to en * feat: change progress doc * feat: rm wrong words * feat: change stsToken params to [stsToken] * feat: add thunk or generator example about progress
1 parent b4f9434 commit 2086bd3

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ options:
144144

145145
- accessKeyId {String} access key you create on aliyun console website
146146
- accessKeySecret {String} access secret you create
147+
- [stsToken] {String} used by temporary authorization, detail [see](https://www.alibabacloud.com/help/doc-detail/32077.htm)
147148
- [bucket] {String} the default bucket you want to access
148149
If you don't have any bucket, please use `putBucket()` create one first.
149150
- [endpoint] {String} oss region domain. It takes priority over `region`.
@@ -1534,7 +1535,7 @@ parameters:
15341535
- [options] {Object} optional args
15351536
- [parallel] {Number} the number of parts to be uploaded in parallel
15361537
- [partSize] {Number} the suggested size for each part
1537-
- [progress] {Function} the progress callback called after each
1538+
- [progress] {Function} thunk or generator, the progress callback called after each
15381539
successful upload of one part, it will be given three parameters:
15391540
(percentage {Number}, checkpoint {Object}, res {Object})
15401541
- [checkpoint] {Object} the checkpoint to resume upload, if this is
@@ -1581,14 +1582,45 @@ var result = yield store.multipartUpload('object', '/tmp/file', {
15811582

15821583
var result = yield store.multipartUpload('object', '/tmp/file', {
15831584
checkpoint: savedCpt,
1584-
progress: function* (p, cpt, res) {
1585+
progress: function* (p, cpt, res) { //progress is generator
15851586
console.log(p);
15861587
console.log(cpt);
15871588
console.log(res.headers['x-oss-request-id']);
15881589
}
15891590
});
15901591

15911592
```
1593+
1594+
- multipartUpload progress example
1595+
1596+
```js
1597+
//thunk
1598+
function thunkProgress(p, cpt, res) {
1599+
return function(done) {
1600+
console.log(p);
1601+
console.log(cpt);
1602+
console.log(res.headers['x-oss-request-id']);
1603+
done();
1604+
}
1605+
}
1606+
1607+
var result1 = yield store.multipartUpload('object', '/tmp/file', {
1608+
progress: thunkProgress
1609+
});
1610+
1611+
//generator
1612+
function* generatorProgress(p, cpt, res) {
1613+
console.log(p);
1614+
console.log(cpt);
1615+
console.log(res.headers['x-oss-request-id']);
1616+
}
1617+
1618+
var result2 = yield store.multipartUpload('object', '/tmp/file', {
1619+
progress: generatorProgress
1620+
});
1621+
1622+
```
1623+
15921624
- multipartUpload with cancel
15931625

15941626
>tips: cancel multipartUpload, now only support browser.

0 commit comments

Comments
 (0)