|
@@ -26,13 +26,13 @@ A project committed to making file access and data transfer easier and more effi
|
26
|
26
|
* [Android Media Scanner, and Download Manager Support](#user-content-android-media-scanner-and-download-manager-support)
|
27
|
27
|
* [Self-Signed SSL Server](#user-content-self-signed-ssl-server)
|
28
|
28
|
* [Transfer Encoding](#user-content-transfer-encoding)
|
29
|
|
- * [RNFetchBlob as Fetch](#user-content-rnfetchblob-as-fetch)
|
|
29
|
+ * [Drop-in Fetch Replacement](#user-content-drop-in-fetch-replacement)
|
30
|
30
|
* [File System](#user-content-file-system)
|
31
|
31
|
* [File access](#user-content-file-access)
|
32
|
32
|
* [File stream](#user-content-file-stream)
|
33
|
33
|
* [Manage cached files](#user-content-cache-file-management)
|
34
|
34
|
* [Web API Polyfills](#user-content-web-api-polyfills)
|
35
|
|
-* [Performance Tips](#user-content-performance-tipsd)
|
|
35
|
+* [Performance Tips](#user-content-performance-tips)
|
36
|
36
|
* [API References](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API)
|
37
|
37
|
* [Caveats](#user-content-caveats)
|
38
|
38
|
* [Development](#user-content-development)
|
|
@@ -452,11 +452,11 @@ task.cancel((err) => { ... })
|
452
|
452
|
|
453
|
453
|
```
|
454
|
454
|
|
455
|
|
-### RNFetchBlob as Fetch
|
|
455
|
+### Drop-in Fetch Replacement
|
456
|
456
|
|
457
|
457
|
0.9.0
|
458
|
458
|
|
459
|
|
-If you have existing code that uses `whatwg-fetch`(the official **fetch**), you don't have to change them after 0.9.0, just use fetch replacement. The difference between Official fetch and fetch replacement is, official fetch uses [whatwg-fetch](https://github.com/github/fetch) js library which wraps XMLHttpRequest polyfill under the hood it's a great library for web developers, however that does not play very well with RN. Our implementation is simply a wrapper of RNFetchBlob.fetch and fs APIs, so you can access all the features we provide.
|
|
459
|
+If you have existing code that uses `whatwg-fetch`(the official **fetch**), it's not necessary to replace them with `RNFetchblob.fetch`, you can simply use our **Fetch Replacement**. The difference between Official them is official fetch uses [whatwg-fetch](https://github.com/github/fetch) which wraps XMLHttpRequest polyfill under the hood. It's a great library for web developers, but does not play very well with RN. Our implementation is simply a wrapper of our `fetch` and `fs` APIs, so you can access all the features we provided.
|
460
|
460
|
|
461
|
461
|
[See document and examples](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API#fetch-replacement)
|
462
|
462
|
|
|
@@ -613,6 +613,8 @@ In `v0.5.0` we've added `writeStream` and `readStream`, which allows your app r
|
613
|
613
|
|
614
|
614
|
When calling `readStream` method, you have to `open` the stream, and start to read data. When the file is large, consider using an appropriate `bufferSize` and `interval` to reduce the native event dispatching overhead (see [Performance Tips](#user-content-performance-tips))
|
615
|
615
|
|
|
616
|
+> The file stream event has a default throttle(10ms) and buffer size which preventing it cause too much overhead to main thread, yo can also [tweak these values](#user-content-performance-tips).
|
|
617
|
+
|
616
|
618
|
```js
|
617
|
619
|
let data = ''
|
618
|
620
|
RNFetchBlob.fs.readStream(
|