You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ A project committed to make file acess and data transfer easier, efficient for R
14
14
- Native-to-native file manipulation API, reduce JS bridging performance loss
15
15
- File stream support for dealing with large file
16
16
- Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
17
+
- JSON stream supported base on [Oboe.js@jimhigson](https://github.com/jimhigson/oboe.js/)
17
18
18
19
## TOC
19
20
*[About](#user-content-about)
@@ -81,13 +82,13 @@ Optionally, use the following command to add Android permissions to `AndroidMani
81
82
RNFB_ANDROID_PERMISSIONS=true react-native link
82
83
```
83
84
84
-
pre 0.29 projects
85
+
pre 0.29 projects
85
86
86
87
```sh
87
88
RNFB_ANDROID_PERMISSIONS=true rnpm link
88
89
```
89
90
90
-
The link script might not take effect if you have non-default project structure, please visit [the wiki](https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package) to manually link the package.
91
+
The link script might not take effect if you have non-default project structure, please visit [the wiki](https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package) to manually link the pacakge.
91
92
92
93
**Grant Permission to External storage for Android 5.0 or lower**
93
94
@@ -156,10 +157,10 @@ To sum up :
156
157
- To send a form data, the `Content-Type` header does not matters. When the body is an `Array` we will set proper content type for you.
157
158
- To send binary data, you have two choices, use BASE64 encoded string or path points to a file contains the body.
158
159
- If the `Content-Type` containing substring`;BASE64` or `application/octet` the given body will be considered as a BASE64 encoded data which will be decoded to binary data as the request body.
159
-
- Otherwise, if a string starts with `RNFetchBlob-file://` (which can simply done by `RNFetchBlob.wrap(PATH_TO_THE_FILE)`), it will try to find the data from the URI string after `RNFetchBlob-file://` and use it as request body.
160
+
- Otherwise, if a string starts with `RNFetchBlob-file://` (which can simply done by `RNFetchBlob.wrap(PATH_TO_THE_FILE)`), it will try to find the data from the URI string after `RNFetchBlob-file://` and use it as request body.
160
161
- To send the body as-is, simply use a `Content-Type` header not containing `;BASE64` or `application/octet`.
161
162
162
-
> It is Worth to mentioning that the HTTP request uses cache by default, if you're going to disable it simply add a Cache Control header `'Cache-Control' : 'no-store'`
163
+
> It is Worth to mentioning that the HTTP request uses cache by default, if you're going to disable it simply add a Cache Control header `'Cache-Control' : 'no-store'`
163
164
164
165
> After 0.9.4, we disabled `Chunked` transfer encoding by default, if you're going to use it, you should explicitly set header `Transfer-Encoding` to `Chunked`.
165
166
@@ -382,7 +383,7 @@ What if you want to append a file to form data ? Just like [upload a file from s
382
383
383
384
### Upload/Download progress
384
385
385
-
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.
386
+
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.
@@ -739,7 +740,7 @@ Here's a [sample app](https://github.com/wkh237/rn-firebase-storage-upload-sampl
739
740
740
741
**Read Stream and Progress Event Overhead**
741
742
742
-
When reading data via `fs.readStream` the process seems blocking JS thread when file is large, it's because the default buffer size is quite small (4kb) which result in large amount of events triggered in JS thread, try to increase the buffer size (for example 100kb = 102400) and set a larger interval (which is introduced in 0.9.4 default value is 10ms) to limit the frequency.
743
+
When reading data via `fs.readStream` the process seems blocking JS thread when file is large, it's because the default buffer size is quite small (4kb) which result in large amount of events triggered in JS thread, try to increase the buffer size (for example 100kb = 102400) and set a larger interval (which is introduced in 0.9.4 default value is 10ms) to limit the frequency.
743
744
744
745
**Reduce RCT Bridge and BASE64 Overhead**
745
746
@@ -761,7 +762,7 @@ If you're going to concatenate files, you don't have to read the data to JS cont
761
762
762
763
## Caveats
763
764
764
-
* This library does not urlencode unicode characters in URL automatically, see [#146](https://github.com/wkh237/react-native-fetch-blob/issues/146).
765
+
* This library does not urlencode unicode characters in URL automatically, see [#146](https://github.com/wkh237/react-native-fetch-blob/issues/146).
765
766
* When a `Blob` is created from existing file, the file **WILL BE REMOVE** if you `close` the blob.
766
767
* If you replaced `window.XMLHttpRequest` for some reason (e.g. make Firebase SDK work), it will also effect how official `fetch` works (basically it should work just fine).
767
768
* When file stream and upload/download progress event slow down your app, consider upgrade to `0.9.6+`, use [additional arguments](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API#fetchprogressconfig-eventlistenerpromisernfetchblobresponse) to limit its frequency.
A project committed to make file acess and data transfer easier, efficient for React Native developers.
6
5
7
-
# [Please visit our Github Page for latest document](https://github.com/wkh237/react-native-fetch-blob)
8
-
9
6
## Features
10
7
- Transfer data directly from/to storage without BASE64 bridging
11
8
- File API supports normal files, Asset files, and CameraRoll files
@@ -85,7 +82,7 @@ pre 0.29 projects
85
82
RNFB_ANDROID_PERMISSIONS=true rnpm link
86
83
```
87
84
88
-
The link script might not take effect if you have non-default project structure, please visit [the wiki](https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package/_edit) to manually link the pacakge.
85
+
The link script might not take effect if you have non-default project structure, please visit [the wiki](https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package) to manually link the pacakge.
89
86
90
87
**Grant Permission to External storage for Android 5.0 or lower**
91
88
@@ -403,6 +400,30 @@ In `version >= 0.4.2` it is possible to know the upload/download progress. After
403
400
})
404
401
```
405
402
403
+
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.
0 commit comments