Browse Source

Merge branch 'master' into 0.9.5

Ben Hsieh 8 years ago
parent
commit
4124f3d54d
3 changed files with 11 additions and 5 deletions
  1. 2
    0
      .github/ISSUE_TEMPLATE
  2. 1
    1
      .github/PULL_REQUEST_TEMPLATE
  3. 8
    4
      README.md

+ 2
- 0
.github/ISSUE_TEMPLATE View File

1
 Hi ! Thank you for reporting an issue, but we would like to remind you, we have a trouble shooting page in our wiki. You may want to take a look on that page :p 
1
 Hi ! Thank you for reporting an issue, but we would like to remind you, we have a trouble shooting page in our wiki. You may want to take a look on that page :p 
2
 
2
 
3
+* please provide the version of installed library and RN project.
4
+* a sample code snippet/repository is very helpful to spotting the problem.
3
 * issues which have been tagged as 'needs feedback', will be closed after 2 weeks if receive no feedbacks.
5
 * issues which have been tagged as 'needs feedback', will be closed after 2 weeks if receive no feedbacks.

+ 1
- 1
.github/PULL_REQUEST_TEMPLATE View File

1
 Thank you for making a pull request ! Just a gentle reminder :)
1
 Thank you for making a pull request ! Just a gentle reminder :)
2
 
2
 
3
 1. If the PR is offering a feature please make the request to our "Feature Branch" 0.10.0
3
 1. If the PR is offering a feature please make the request to our "Feature Branch" 0.10.0
4
-2. Bug fix request to "Bug Fix Branch" 0.9.4
4
+2. Bug fix request to "Bug Fix Branch" 0.9.5
5
 3. Correct README.md can directly to master
5
 3. Correct README.md can directly to master

+ 8
- 4
README.md View File

4
 
4
 
5
 A project committed to make file acess and data transfer easier, efficient for React Native developers.
5
 A project committed to make file acess and data transfer easier, efficient for React Native developers.
6
 
6
 
7
+> The npm package is inside `src` folder, if you're going to install using github repository do not point to here directly
8
+
7
 ## Features
9
 ## Features
8
 - Transfer data directly from/to storage without BASE64 bridging
10
 - Transfer data directly from/to storage without BASE64 bridging
9
 - File API supports normal files, Asset files, and CameraRoll files
11
 - File API supports normal files, Asset files, and CameraRoll files
11
 - File stream support for dealing with large file
13
 - File stream support for dealing with large file
12
 - Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
14
 - Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
13
 
15
 
14
-> The npm package is inside `src` folder, if you're going to install via git repository do not directly poiint to this folder
15
-
16
 ## TOC
16
 ## TOC
17
 * [About](#user-content-about)
17
 * [About](#user-content-about)
18
 * [Installation](#user-content-installation)
18
 * [Installation](#user-content-installation)
157
  - 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. 
157
  - 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. 
158
 - To send the body as-is, simply use a `Content-Type` header not containing `;BASE64` or `application/octet`.
158
 - To send the body as-is, simply use a `Content-Type` header not containing `;BASE64` or `application/octet`.
159
 
159
 
160
+> 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'` 
161
+
160
 > 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`.
162
 > 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`.
161
 
163
 
162
 ### Download example : Fetch files that needs authorization token
164
 ### Download example : Fetch files that needs authorization token
268
     }),
270
     }),
269
     'Content-Type' : 'application/octet-stream',
271
     'Content-Type' : 'application/octet-stream',
270
     // here's the body you're going to send, should be a BASE64 encoded string
272
     // here's the body you're going to send, should be a BASE64 encoded string
271
-    // (you can use "base64" APIs to make one).
273
+    // (you can use "base64"(refer to the library 'mathiasbynens/base64') APIs to make one).
272
     // The data will be converted to "byte array"(say, blob) before request sent.  
274
     // The data will be converted to "byte array"(say, blob) before request sent.  
273
   }, base64ImageString)
275
   }, base64ImageString)
274
   .then((res) => {
276
   .then((res) => {
709
 
711
 
710
 ## Performance Tips
712
 ## Performance Tips
711
 
713
 
712
-**Reduce RCT Bridge and BASE64 Overheard**
714
+**Read Stream Event Overhead**
713
 
715
 
714
 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. 
716
 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. 
715
 
717
 
718
+**Reduce RCT Bridge and BASE64 Overhead**
719
+
716
 React Native connects JS and Native context by passing JSON around React Native bridge, and there will be an overhead to convert data before they sent to each side. When data is large, this will be quite a performance impact to your app, it's recommended to use file storage instead of BASE64 if possible.The following chart shows how much faster when loading data from storage than BASE64 encoded string on iphone 6.
720
 React Native connects JS and Native context by passing JSON around React Native bridge, and there will be an overhead to convert data before they sent to each side. When data is large, this will be quite a performance impact to your app, it's recommended to use file storage instead of BASE64 if possible.The following chart shows how much faster when loading data from storage than BASE64 encoded string on iphone 6.
717
 
721
 
718
 <img src="img/performance_1.png" style="width : 100%"/>
722
 <img src="img/performance_1.png" style="width : 100%"/>