|
|
|
|
145
|
|
145
|
|
146
|
To sum up :
|
146
|
To sum up :
|
147
|
|
147
|
|
148
|
-- If you're going to send a form data, the `Content-Type` header won't take effect if the body is an `Array` because we will set proper content type for you.
|
|
|
149
|
-- If you're going to send binary data, you have two choices, use BASE64 encoded string or a file path which points to a file contains the body. The `Content-Type` header does not matters.
|
|
|
150
|
- - If the body is a BASE64 encoded string, the `Content-Type` header filed must containing substring`;BASE64` or `application/octet`
|
|
|
151
|
- - If the body is a path point to a file, it must be a string starts with `RNFetchBlob-file://`, which can simply done by `RNFetchBlob.wrap(PATH_TO_THE_FILE)`
|
|
|
152
|
-- If you're going to send the body as-is, set a `Content-Type` header not containing `;BASE64` or `application/octet`.
|
|
|
|
|
148
|
+- To send a form data, the `Content-Type` header won't take effect if the body is an `Array` because we will set proper content type for you.
|
|
|
149
|
+- To send binary data, you have two choices, use BASE64 encoded string or a file path which points to a file contains the body. The `Content-Type` header does not matters.
|
|
|
150
|
+ - The body is a BASE64 encoded string, the `Content-Type` header filed must containing substring`;BASE64` or `application/octet`
|
|
|
151
|
+ - The body is a path point to a file, it must be a string starts with `RNFetchBlob-file://`, which can simply done by `RNFetchBlob.wrap(PATH_TO_THE_FILE)`
|
|
|
152
|
+- To send the body as-is, set a `Content-Type` header not containing `;BASE64` or `application/octet`.
|
153
|
|
153
|
|
154
|
#### Download example : Fetch files that needs authorization token
|
154
|
#### Download example : Fetch files that needs authorization token
|
155
|
|
155
|
|
|
|
|
|
649
|
- Blob
|
649
|
- Blob
|
650
|
- XMLHttpRequest (Use our implementation if you're going to use it with Blob)
|
650
|
- XMLHttpRequest (Use our implementation if you're going to use it with Blob)
|
651
|
|
651
|
|
|
|
652
|
+### Performance Tips
|
|
|
653
|
+
|
|
|
654
|
+React Native connects JS and Native context by passing JSON through RCT bridge, therefore there will an overhead to convert data before they sent. When data is large, this will be quite a performance impact to your app. When upload and download large data it's better to use file storage instead of BASE64 encoding. The following chart show how much faster when loading a data from storage than BASE64 encoded string on iphone 6.
|
|
|
655
|
+
|
|
|
656
|
+<img src="img/performance_1.png" style="width : 100%"/>
|
|
|
657
|
+
|
|
|
658
|
+TODO
|
|
|
659
|
+
|
652
|
|
660
|
|
653
|
## Changes
|
661
|
## Changes
|
654
|
|
662
|
|