Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 78c66a7

Browse files
authored
Update README.md
1 parent 0895312 commit 78c66a7

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

README.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A project committed to make file acess and data transfer easier, efficient for R
1111
- File stream support for dealing with large file
1212
- Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
1313

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
1515
1616
## TOC
1717
* [About](#user-content-about)
@@ -140,11 +140,10 @@ If you're using ES5 require statement to load the module, please add `default`.
140140
var RNFetchBlob = require('react-native-fetch-blob').default
141141
```
142142

143-
### HTTP Data Transfer
143+
## HTTP Data Transfer
144144

145-
---
146145

147-
#### Regular Request
146+
### Regular Request
148147

149148
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
150149

@@ -160,7 +159,7 @@ To sum up :
160159

161160
> 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`.
162161
163-
#### Download example : Fetch files that needs authorization token
162+
### Download example : Fetch files that needs authorization token
164163

165164
Most simple way is download to memory and stored as BASE64 encoded string, this is handy when the response data is small.
166165

@@ -186,7 +185,7 @@ RNFetchBlob.fetch('GET', 'http://www.example.com/images/img1.png', {
186185
})
187186
```
188187

189-
#### Download to storage directly
188+
### Download to storage directly
190189

191190
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.
192191

@@ -280,7 +279,7 @@ RNFetchBlob.fetch('POST', 'https://content.dropboxapi.com/2/files/upload', {
280279
})
281280
```
282281

283-
#### Upload a file from storage
282+
### Upload a file from storage
284283

285284
If you're going to use a `file` as request body, just wrap the path with `wrap` API.
286285

@@ -306,7 +305,7 @@ RNFetchBlob.fetch('POST', 'https://content.dropboxapi.com/2/files/upload', {
306305
})
307306
```
308307

309-
#### Multipart/form-data example : Post form data with file and data
308+
### Multipart/form-data example : Post form data with file and data
310309

311310
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).
312311

@@ -377,7 +376,7 @@ What if you want to append a file to form data ? Just like [upload a file from s
377376
})
378377
```
379378

380-
#### Upload/Download progress
379+
### Upload/Download progress
381380

382381
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.
383382

@@ -402,7 +401,7 @@ In `version >= 0.4.2` it is possible to know the upload/download progress. After
402401
})
403402
```
404403

405-
#### Cancel Request
404+
### Cancel Request
406405

407406
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.
408407

@@ -541,9 +540,9 @@ Or show an image in image viewer
541540
android.actionViewIntent(PATH_OF_IMG, 'image/png')
542541
```
543542

544-
### File System
543+
## File System
545544

546-
#### File Access
545+
### File Access
547546

548547
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.
549548

@@ -571,7 +570,7 @@ File Access APIs
571570

572571
See [File API](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API) for more information
573572

574-
#### File Stream
573+
### File Stream
575574

576575
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**.
577576

@@ -620,7 +619,7 @@ RNFetchBlob.fs.writeStream(
620619

621620
```
622621

623-
#### Cache File Management
622+
### Cache File Management
624623

625624
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
626625

@@ -677,15 +676,15 @@ You can also grouping requests by using `session` API, and use `dispose` to remo
677676

678677
```
679678

680-
#### Transfer Encoding
679+
### Transfer Encoding
681680

682681
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`.
683682

684683
```js
685684
RNFetchBlob.fetch('POST', 'http://example.com/upload', { 'Transfer-Encoding' : 'Chunked' }, bodyData)
686685
```
687686

688-
#### Self-Signed SSL Server
687+
### Self-Signed SSL Server
689688

690689
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`
691690

@@ -699,7 +698,7 @@ RNFetchBlob.config({
699698
})
700699
```
701700

702-
### Web API Polyfills
701+
## Web API Polyfills
703702

704703
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.
705704

@@ -708,9 +707,7 @@ After `0.8.0` we've made some [Web API polyfills](https://github.com/wkh237/reac
708707

709708
Here's a [sample app](https://github.com/wkh237/rn-firebase-storage-upload-sample) that uses polyfills to upload files to FireBase.
710709

711-
### Performance Tips
712-
713-
---
710+
## Performance Tips
714711

715712
**Reduce RCT Bridge and BASE64 Overheard**
716713

0 commit comments

Comments
 (0)