Skip to content

Commit 30d6f11

Browse files
committed
Merge branch '0.9.6' of github.com:wkh237/react-native-fetch-blob into 0.9.6
2 parents dbaeef1 + a9cf7a2 commit 30d6f11

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ What if you want to append a file to form data ? Just like [upload a file from s
380380

381381
### Upload/Download progress
382382

383-
In `version >= 0.4.2` it is possible to know the upload/download progress. After `0.7.0` IOS and Android upload progress are also supported.
383+
In `version >= 0.4.2` it is possible to know the upload/download progress. After `0.7.0` IOS and Android upload progress are also supported.
384384

385385
```js
386386
RNFetchBlob.fetch('POST', 'http://www.example.com/upload', {
@@ -403,6 +403,30 @@ In `version >= 0.4.2` it is possible to know the upload/download progress. After
403403
})
404404
```
405405

406+
In `0.9.6`, you can specify an optional first argument which contains `count` and `interval` to limit progress event frequency (this will be done in native context in order to reduce RCT bridge overhead). Notice that `count` argument will not work if the server does not provide response content length.
407+
408+
409+
```js
410+
RNFetchBlob.fetch('POST', 'http://www.example.com/upload', {
411+
... some headers,
412+
'Content-Type' : 'octet-stream'
413+
}, base64DataString)
414+
// listen to upload progress event, emit every 250ms
415+
.uploadProgress({ interval : 250 },(written, total) => {
416+
console.log('uploaded', written / total)
417+
})
418+
// listen to download progress event, every 10%
419+
.progress({ count : 10 }, (received, total) => {
420+
console.log('progress', received / total)
421+
})
422+
.then((resp) => {
423+
// ...
424+
})
425+
.catch((err) => {
426+
// ...
427+
})
428+
```
429+
406430
### Cancel Request
407431

408432
After `0.7.0` it is possible to cancel a HTTP request. When the request cancel, it will definately throws an promise rejection, be sure to catch it.

0 commit comments

Comments
 (0)