wkh237 преди 8 години
родител
ревизия
a6417c33bf
променени са 1 файла, в които са добавени 13 реда и са изтрити 5 реда
  1. 13
    5
      README.md

+ 13
- 5
README.md Целия файл

@@ -145,11 +145,11 @@ After `0.8.0` react-native-fetch-blob automatically decide how to send the body
145 145
 
146 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 154
 #### Download example : Fetch files that needs authorization token
155 155
 
@@ -649,6 +649,14 @@ After `0.8.0` we've made some [Web API polyfills](https://github.com/wkh237/reac
649 649
 - Blob
650 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 661
 ## Changes
654 662