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
+17-20Lines changed: 17 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ A project committed to make file acess and data transfer easier, efficient for R
11
11
- File stream support for dealing with large file
12
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
16
## TOC
17
17
*[About](#user-content-about)
@@ -140,11 +140,10 @@ If you're using ES5 require statement to load the module, please add `default`.
140
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
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,7 +159,7 @@ To sum up :
160
159
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
161
163
-
####Download example : Fetch files that needs authorization token
162
+
### Download example : Fetch files that needs authorization token
164
163
165
164
Most simple way is download to memory and stored as BASE64 encoded string, this is handy when the response data is small.
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.
####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
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,7 +376,7 @@ What if you want to append a file to form data ? Just like [upload a file from s
377
376
})
378
377
```
379
378
380
-
####Upload/Download progress
379
+
### Upload/Download progress
381
380
382
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,7 +401,7 @@ In `version >= 0.4.2` it is possible to know the upload/download progress. After
402
401
})
403
402
```
404
403
405
-
####Cancel Request
404
+
### Cancel Request
406
405
407
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,9 +540,9 @@ Or show an image in image viewer
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,7 +570,7 @@ File Access APIs
571
570
572
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
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,7 +619,7 @@ RNFetchBlob.fs.writeStream(
620
619
621
620
```
622
621
623
-
####Cache File Management
622
+
### Cache File Management
624
623
625
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,15 +676,15 @@ You can also grouping requests by using `session` API, and use `dispose` to remo
677
676
678
677
```
679
678
680
-
####Transfer Encoding
679
+
### Transfer Encoding
681
680
682
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`.
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,7 +698,7 @@ RNFetchBlob.config({
699
698
})
700
699
```
701
700
702
-
###Web API Polyfills
701
+
## Web API Polyfills
703
702
704
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,9 +707,7 @@ After `0.8.0` we've made some [Web API polyfills](https://github.com/wkh237/reac
708
707
709
708
Here's a [sample app](https://github.com/wkh237/rn-firebase-storage-upload-sample) that uses polyfills to upload files to FireBase.
0 commit comments