Skip to content

Commit a11934b

Browse files
authored
Update README.md
1 parent d06620c commit a11934b

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

README.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
[![release](https://img.shields.io/github/release/wkh237/react-native-fetch-blob.svg?style=flat-square)](https://github.com/wkh237/react-native-fetch-blob/releases) [![npm](https://img.shields.io/npm/v/react-native-fetch-blob.svg?style=flat-square)](https://www.npmjs.com/package/react-native-fetch-blob) ![](https://img.shields.io/badge/PR-Welcome-brightgreen.svg?style=flat-square) [![](https://img.shields.io/badge/Wiki-Public-brightgreen.svg?style=flat-square)](https://github.com/wkh237/react-native-fetch-blob/wiki) [![npm](https://img.shields.io/npm/l/react-native-fetch-blob.svg?maxAge=2592000&style=flat-square)]()
33

44

5-
A project committed to make file access and data transfer easier, efficient for React Native developers.
5+
A project committed to making file access and data transfer easier, efficient for React Native developers.
66

7-
> If you're going to use GitHub repo as npm dependency please visit the [archive repository](https://github.com/wkh237/react-native-fetch-blob-package/releases/tag/v0.9.6).
7+
> If you're going to use GitHub repo as npm dependency, please visit the [archive repository](https://github.com/wkh237/react-native-fetch-blob-package/releases/tag/v0.9.6).
88
99
> For Firebase Storage solution, please upgrade to latest version for best compatibility.
1010
1111
## Features
1212
- Transfer data directly from/to storage without BASE64 bridging
13-
- File API supports normal files, Asset files, and CameraRoll files
13+
- File API supports regular files, Asset files, and CameraRoll files
1414
- Native-to-native file manipulation API, reduce JS bridging performance loss
1515
- File stream support for dealing with large file
1616
- Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
@@ -88,11 +88,11 @@ pre 0.29 projects
8888
RNFB_ANDROID_PERMISSIONS=true rnpm link
8989
```
9090

91-
The link script might not take effect if you have non-default project structure, please visit [the wiki](https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package) to manually link the package.
91+
The link script might not take effect if you have non-default project structure, please visit [the wiki](https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package) to link the package manually.
9292

9393
**Grant Permission to External storage for Android 5.0 or lower**
9494

95-
Mechanism for granting Android permissions has slightly different since Android 6.0 released, please refer to [Official Document](https://developer.android.com/training/permissions/requesting.html).
95+
The mechanism for granting Android permissions has slightly different since Android 6.0 released, please refer to [Official Document](https://developer.android.com/training/permissions/requesting.html).
9696

9797
If you're going to access external storage (say, SD card storage) for `Android 5.0` (or lower) devices, you might have to add the following line to `AndroidManifest.xml`.
9898

@@ -237,7 +237,7 @@ RNFetchBlob
237237

238238
**Use Specific File Path**
239239

240-
If you prefer a specific path rather than randomly generated one, you can use `path` option. We've added [several constants](#user-content-dirs) in v0.5.0 which represents commonly used directories.
240+
If you prefer a particular file path rather than randomly generated one, you can use `path` option. We've added [several constants](#user-content-dirs) in v0.5.0 which represents commonly used directories.
241241

242242
```js
243243
let dirs = RNFetchBlob.fs.dirs
@@ -259,7 +259,7 @@ RNFetchBlob
259259

260260
#### Upload example : Dropbox [files-upload](https://www.dropbox.com/developers/documentation/http/documentation#files-upload) API
261261

262-
`react-native-fetch-blob` will convert the base64 string in `body` to binary format using native API, this process will be done in a separated thread, so it won't block your GUI.
262+
`react-native-fetch-blob` will convert the base64 string in `body` to binary format using native API, this process is done in a separated thread so that it won't block your GUI.
263263

264264
```js
265265

@@ -406,7 +406,7 @@ In `version >= 0.4.2` it is possible to know the upload/download progress. After
406406
})
407407
```
408408

409-
In `0.9.6`, you can specify an object as the first argument which contains `count` and `interval`, to the frequency of progress event (this will be done in the native context a reduce RCT bridge overhead). Notice that `count` argument will not work if the server does not provide response content length.
409+
In `0.9.6`, you can specify an object as the first argument which contains `count` and `interval`, to the frequency of progress event (this will be done in the native context a reduce RCT bridge overhead). Notice that `count` argument will not work if the server does not provide response content length.
410410

411411

412412
```js
@@ -432,7 +432,7 @@ In `0.9.6`, you can specify an object as the first argument which contains `coun
432432

433433
### Cancel Request
434434

435-
After `0.7.0` it is possible to cancel an HTTP request. When the request is canceled, it will throw a promise rejection, be sure to catch it.
435+
After `0.7.0` it is possible to cancel an HTTP request. Upon cancellation, it throws a promise rejection, be sure to catch it.
436436

437437
```js
438438
let task = RNFetchBlob.fetch('GET', 'http://example.com/file/1')
@@ -461,7 +461,7 @@ If you want to make a file in `External Storage` becomes visible in Picture, Dow
461461

462462
**Media Scanner**
463463

464-
Media scanner scans the file and categorize by given MIME type, if MIME type not specified, it will try to resolve the file using its file extension.
464+
Media scanner scans the file and categorizes by given MIME type, if MIME type not specified, it will try to resolve the file using its file extension.
465465

466466
```js
467467

@@ -482,7 +482,7 @@ RNFetchBlob
482482

483483
**Download Manager**
484484

485-
When downloading large files on Android it is recommended to use `Download Manager`, it supports a lot of native features like the progress bar, and notification, also the download task will be handled by OS, and more effective.
485+
When downloading large files on Android it is recommended to use `Download Manager`, it supports a lot of native features like the progress bar, and notification, also the download task will be handled by OS, and more efficient.
486486

487487
<img src="img/download-manager.png" width="256">
488488

@@ -515,7 +515,7 @@ RNFetchBlob
515515
<img src="img/android-notification2.png" width="256">
516516

517517

518-
If you want to display a notification when the file is completely download to storage (as the above) or make the downloaded file visible in "Downloads" app. You have to add some options to `config`.
518+
If you need to display a notification upon the file is downloaded to storage (as the above) or make the downloaded file visible in "Downloads" app. You have to add some options to `config`.
519519

520520
```js
521521
RNFetchBlob.config({
@@ -539,7 +539,7 @@ RNFetchBlob.config({
539539

540540
**Open Downloaded File with Intent**
541541

542-
This is a new feature added in `0.9.0` if you're going to open a file path using official [Linking](https://facebook.github.io/react-native/docs/linking.html) API that might not work as expected, also, if you're going to install an APK in `Downloads` app, that will not work too. As an alternative, you can try `actionViewIntent` API, which will send an ACTION_VIEW intent for you which uses the given `MIME` type.
542+
This is a new feature added in `0.9.0` if you're going to open a file path using official [Linking](https://facebook.github.io/react-native/docs/linking.html) API that might not work as expected, also, if you're going to install an APK in `Downloads` app, that will not function too. As an alternative, you can try `actionViewIntent` API, which will send an ACTION_VIEW intent for you which uses the given `MIME` type.
543543

544544
Download and install an APK programmatically
545545

@@ -573,7 +573,7 @@ Or show an image in image viewer
573573

574574
### File Access
575575

576-
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, everyone who uses this module may need these APIs for there cases.
576+
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, everyone who uses this module may need these APIs for their cases.
577577

578578
Before start using file APIs, we recommend read [Differences between File Source](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#differences-between-file-source) first.
579579

@@ -601,7 +601,7 @@ See [File API](https://github.com/wkh237/react-native-fetch-blob/wiki/File-Syste
601601

602602
### File Stream
603603

604-
In `v0.5.0` we've added `writeStream` and `readStream`, which allows your app read/write data from the file path. This API creates a file stream, rather than convert whole data into BASE64 encoded string, it's handy when processing **large files**.
604+
In `v0.5.0` we've added `writeStream` and `readStream`, which allows your app read/write data from the file path. This API creates a file stream, rather than convert entire data into BASE64 encoded string. It's handy when processing **large files**.
605605

606606
When calling `readStream` method, you have to `open` the stream, and start to read data. When the file is large, consider using an appropriate `bufferSize` and `interval` to reduce the native event dispatching overhead (see [Performance Tips](#user-content-performance-tips))
607607

@@ -631,7 +631,7 @@ RNFetchBlob.fs.readStream(
631631
})
632632
```
633633

634-
When using `writeStream`, the stream is also opened immediately, but you have to `write`, and `close` by yourself.
634+
When using `writeStream`, the stream object becomes writable, and you can then perform operations like `write` and `close`.
635635

636636
```js
637637
RNFetchBlob.fs.writeStream(
@@ -715,7 +715,7 @@ RNFetchBlob.fetch('POST', 'http://example.com/upload', { 'Transfer-Encoding' : '
715715

716716
### Self-Signed SSL Server
717717

718-
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`
718+
By default, react-native-fetch-blob does NOT allow connection to unknown certification provider since it's dangerous. To connect a server with self-signed certification, you need to add `trusty` to `config` explicitly. This function is available for version >= `0.5.3`
719719

720720
```js
721721
RNFetchBlob.config({
@@ -740,11 +740,11 @@ Here's a [sample app](https://github.com/wkh237/rn-firebase-storage-upload-sampl
740740

741741
**Read Stream and Progress Event Overhead**
742742

743-
When reading data via `fs.readStream` the process seems to block 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.
743+
If the process seems to block JS thread when file is large when reading data via `fs.readStream`. It might because the default buffer size is quite small (4kb) which result in a lot of events triggered from JS thread. Try to increase the buffer size (for example 100kb = 102400) and set a larger interval (available for 0.9.4+, the default value is 10ms) to limit the frequency.
744744

745745
**Reduce RCT Bridge and BASE64 Overhead**
746746

747-
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.
747+
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.
748748

749749
<img src="img/performance_1.png" style="width : 100%"/>
750750

@@ -754,9 +754,9 @@ Due to the [lack of typed array implementation in JavascriptCore, and limitation
754754

755755
<img src="img/performance_encoding.png" style="width : 100%"/>
756756

757-
**Concate and Replacing Files**
757+
**Concat and Replacing Files**
758758

759-
If you're going to concatenate files, you don't have to read the data to JS context anymore! In `0.8.0` we introduced new encoding `uri` for writeFile and appendFile API. Which make it possible to done the whole process in native.
759+
If you're going to concatenate files, you don't have to read the data to JS context anymore! In `0.8.0` we introduced new encoding `uri` for writeFile and appendFile API, which make it possible to handle the whole process in native.
760760

761761
<img src="img/performance_f2f.png" style="width : 100%"/>
762762

@@ -768,7 +768,7 @@ If you're going to concatenate files, you don't have to read the data to JS cont
768768
* When file stream and upload/download progress event slow down your app, consider an upgrade to `0.9.6+`, use [additional arguments](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API#fetchprogressconfig-eventlistenerpromisernfetchblobresponse) to limit its frequency.
769769
* When passing a file path to the library, remove `file://` prefix.
770770

771-
when you got problem, have a look at [Trouble Shooting](https://github.com/wkh237/react-native-fetch-blob/wiki/Trouble-Shooting) or [issues labeled Trouble Shooting](https://github.com/wkh237/react-native-fetch-blob/issues?utf8=✓&q=label:%22trouble%20shooting%22%20), there'd be some helpful information.
771+
when you got a problem, have a look at [Trouble Shooting](https://github.com/wkh237/react-native-fetch-blob/wiki/Trouble-Shooting) or [issues labeled Trouble Shooting](https://github.com/wkh237/react-native-fetch-blob/issues?utf8=✓&q=label:%22trouble%20shooting%22%20), there'd be some helpful information.
772772

773773
## Changes
774774

0 commit comments

Comments
 (0)