Browse Source

Update README.md

wkh237 8 years ago
parent
commit
78c66a74de
1 changed files with 17 additions and 20 deletions
  1. 17
    20
      README.md

+ 17
- 20
README.md View File

11
 - File stream support for dealing with large file
11
 - File stream support for dealing with large file
12
 - Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
12
 - Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
13
 
13
 
14
-> The npm package is inside `src` folder, this is development folder
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
 
15
 
16
 ## TOC
16
 ## TOC
17
 * [About](#user-content-about)
17
 * [About](#user-content-about)
140
 var RNFetchBlob = require('react-native-fetch-blob').default
140
 var RNFetchBlob = require('react-native-fetch-blob').default
141
 ```
141
 ```
142
 
142
 
143
-### HTTP Data Transfer
143
+## HTTP Data Transfer
144
 
144
 
145
----
146
 
145
 
147
-#### Regular Request
146
+### Regular Request
148
 
147
 
149
 After `0.8.0` react-native-fetch-blob automatically decide how to send the body by checking its type and `Content-Type` in header. The rule is described in the following diagram
148
 After `0.8.0` react-native-fetch-blob automatically decide how to send the body by checking its type and `Content-Type` in header. The rule is described in the following diagram
150
 
149
 
160
 
159
 
161
 > 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`.
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
 
161
 
163
-#### Download example : Fetch files that needs authorization token
162
+### Download example : Fetch files that needs authorization token
164
 
163
 
165
 Most simple way is download to memory and stored as BASE64 encoded string, this is handy when the response data is small.
164
 Most simple way is download to memory and stored as BASE64 encoded string, this is handy when the response data is small.
166
 
165
 
186
   })
185
   })
187
 ```
186
 ```
188
 
187
 
189
-#### Download to storage directly
188
+### Download to storage directly
190
 
189
 
191
 If the response data is large, that would be a bad idea to convert it into BASE64 string. A better solution is streaming the response directly into a file, simply add a `fileCache` option to config, and set it to `true`. This will make incoming response data stored in a temporary path **without** any file extension.
190
 If the response data is large, that would be a bad idea to convert it into BASE64 string. A better solution is streaming the response directly into a file, simply add a `fileCache` option to config, and set it to `true`. This will make incoming response data stored in a temporary path **without** any file extension.
192
 
191
 
280
   })
279
   })
281
 ```
280
 ```
282
 
281
 
283
-#### Upload a file from storage
282
+### Upload a file from storage
284
 
283
 
285
 If you're going to use a `file` as request body, just wrap the path with `wrap` API.
284
 If you're going to use a `file` as request body, just wrap the path with `wrap` API.
286
 
285
 
306
   })
305
   })
307
 ```
306
 ```
308
 
307
 
309
-#### Multipart/form-data example : Post form data with file and data
308
+### Multipart/form-data example : Post form data with file and data
310
 
309
 
311
 In `version >= 0.3.0` you can also post files with form data, just put an array in `body`, with elements have property `name`, `data`, and `filename`(optional).
310
 In `version >= 0.3.0` you can also post files with form data, just put an array in `body`, with elements have property `name`, `data`, and `filename`(optional).
312
 
311
 
377
   })
376
   })
378
 ```
377
 ```
379
 
378
 
380
-#### Upload/Download progress
379
+### Upload/Download progress
381
 
380
 
382
 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.
381
 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.
383
 
382
 
402
     })
401
     })
403
 ```
402
 ```
404
 
403
 
405
-#### Cancel Request
404
+### Cancel Request
406
 
405
 
407
 After `0.7.0` it is possible to cancel a HTTP request. When the request cancel, it will definately throws an promise rejection, be sure to catch it.
406
 After `0.7.0` it is possible to cancel a HTTP request. When the request cancel, it will definately throws an promise rejection, be sure to catch it.
408
 
407
 
541
       android.actionViewIntent(PATH_OF_IMG, 'image/png')
540
       android.actionViewIntent(PATH_OF_IMG, 'image/png')
542
 ```
541
 ```
543
 
542
 
544
-### File System
543
+## File System
545
 
544
 
546
-#### File Access
545
+### File Access
547
 
546
 
548
 File access APIs were made when developing `v0.5.0`, which helping us write tests, and was not planned to be a part of this module. However we realized that, it's hard to find a great solution to manage cached files, every one who use this moudle may need these APIs for there cases.
547
 File access APIs were made when developing `v0.5.0`, which helping us write tests, and was not planned to be a part of this module. However we realized that, it's hard to find a great solution to manage cached files, every one who use this moudle may need these APIs for there cases.
549
 
548
 
571
 
570
 
572
 See [File API](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API) for more information
571
 See [File API](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API) for more information
573
 
572
 
574
-#### File Stream
573
+### File Stream
575
 
574
 
576
 In `v0.5.0` we've added  `writeStream` and `readStream`, which allows your app read/write data from file path. This API creates a file stream, rather than convert whole data into BASE64 encoded string, it's handy when processing **large files**.
575
 In `v0.5.0` we've added  `writeStream` and `readStream`, which allows your app read/write data from file path. This API creates a file stream, rather than convert whole data into BASE64 encoded string, it's handy when processing **large files**.
577
 
576
 
620
 
619
 
621
 ```
620
 ```
622
 
621
 
623
-#### Cache File Management
622
+### Cache File Management
624
 
623
 
625
 When using `fileCache` or `path` options along with `fetch` API, response data will automatically stored into file system. The files will **NOT** removed unless you `unlink` it. There're several ways to remove the files
624
 When using `fileCache` or `path` options along with `fetch` API, response data will automatically stored into file system. The files will **NOT** removed unless you `unlink` it. There're several ways to remove the files
626
 
625
 
677
 
676
 
678
 ```
677
 ```
679
 
678
 
680
-#### Transfer Encoding
679
+### Transfer Encoding
681
 
680
 
682
 After `0.9.4`, the `Chunked` transfer encoding is disabled by default due to some service provoder may not support chunked transfer. To enable it, set `Transfer-Encoding` header to `Chunked`.
681
 After `0.9.4`, the `Chunked` transfer encoding is disabled by default due to some service provoder may not support chunked transfer. To enable it, set `Transfer-Encoding` header to `Chunked`.
683
 
682
 
685
 RNFetchBlob.fetch('POST', 'http://example.com/upload', { 'Transfer-Encoding' : 'Chunked' }, bodyData)
684
 RNFetchBlob.fetch('POST', 'http://example.com/upload', { 'Transfer-Encoding' : 'Chunked' }, bodyData)
686
 ```
685
 ```
687
 
686
 
688
-#### Self-Signed SSL Server
687
+### Self-Signed SSL Server
689
 
688
 
690
 By default, react-native-fetch-blob does NOT allow connection to unknown certification provider since it's dangerous. If you're going to connect a server with self-signed certification, add `trusty` to `config`. This function is available for version >= `0.5.3`
689
 By default, react-native-fetch-blob does NOT allow connection to unknown certification provider since it's dangerous. If you're going to connect a server with self-signed certification, add `trusty` to `config`. This function is available for version >= `0.5.3`
691
 
690
 
699
 })
698
 })
700
 ```
699
 ```
701
 
700
 
702
-### Web API Polyfills
701
+## Web API Polyfills
703
 
702
 
704
 After `0.8.0` we've made some [Web API polyfills](https://github.com/wkh237/react-native-fetch-blob/wiki/Web-API-Polyfills-(experimental)) that makes some browser-based library available in RN.
703
 After `0.8.0` we've made some [Web API polyfills](https://github.com/wkh237/react-native-fetch-blob/wiki/Web-API-Polyfills-(experimental)) that makes some browser-based library available in RN.
705
 
704
 
708
 
707
 
709
 Here's a [sample app](https://github.com/wkh237/rn-firebase-storage-upload-sample) that uses polyfills to upload files to FireBase.
708
 Here's a [sample app](https://github.com/wkh237/rn-firebase-storage-upload-sample) that uses polyfills to upload files to FireBase.
710
 
709
 
711
-### Performance Tips
712
-
713
----
710
+## Performance Tips
714
 
711
 
715
 **Reduce RCT Bridge and BASE64 Overheard**
712
 **Reduce RCT Bridge and BASE64 Overheard**
716
 
713