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

Commit ea478fa

Browse files
committed
Change README.md in src folder
1 parent 08fd765 commit ea478fa

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

src/README.md

+27-25
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ A module provides upload, download, and files access API. Supports file stream r
44

55
**Why do we need this**
66

7-
At this moment, React Native does not support `Blob` object yet, so if you're going to send/receive binary data via `fetch` API, that might not work as you expect. See [[fetch] Does fetch with blob() marshal data across the bridge?](https://github.com/facebook/react-native/issues/854).
7+
React Native does not support `Blob` object at this moment, which means if you're going to send/receive binary data via `fetch` API, that might not work as you expect. See [[fetch] Does fetch with blob() marshal data across the bridge?](https://github.com/facebook/react-native/issues/854).
88

9-
Hence you may getting into trouble in some use cases. For example, displaying an image on image server but the server requires a specific field(such as "Authorization") in headers or body, so you can't just pass the image uri to `Image` component because that will probably returns a 401 response. With help of this module, you can send a HTTP request with any headers, and decide how to handle the response/reqeust data. The response data can be just simply converted into BASE64 string, or store to a file directly so that you can read it by file stream or use it's path.
9+
For some uses cases, you might get into trouble. For example, displaying an image that requires a specific field in headers (ex. "Authorization : Bearer ...") or body, so you can't just pass the image uri to `Image` component because that will probably returns a 401 response. Or you're going to upload binary data which generated from JS, the server will get an empry body due to [this issue](https://github.com/facebook/react-native/issues/854). With help of this APIs provides by this module, you can send HTTP request with any headers, and decide how to handle the response/reqeust data without worry about if it is not supported by `fetch` API. The response data can be just simply converted into BASE64 string, or store to a file directly so that you can read it by file access APIs such as readFile, readStream.
1010

11-
This module is designed to be a substitution of `blob`, there's a set of file access API including basic CRUD method, and file stream reader/writer. Also it has a special `fetch` implementation that supports binary request/response body.
11+
This module was designed to be a substitution of `Blob`, there's a set of APIs including basic file system CRUD method, and file stream reader/writer. Also it has a special `fetch` implementation that supports binary request/response body.
1212

1313
**Pre v0.5.0 Users**
1414

@@ -21,11 +21,11 @@ This update is `backward-compatible` generally you don't have to change existing
2121
* [Download file](#user-content-download-example--fetch-files-that-needs-authorization-token)
2222
* [Upload file](#user-content-upload-example--dropbox-files-upload-api)
2323
* [Multipart/form upload](#user-content-multipartform-data-example--post-form-data-with-file-and-data)
24-
* [Upload/Download progress](#user-content-uploaaddownload-progress)
25-
* [Android Media Scanner, and Download Manager Support](#user-content-android-media-scanner-and-downloads-app-support)
24+
* [Upload/Download progress](#user-content-uploaddownload-progress)
25+
* [Android Media Scanner, and Download Manager Support](#user-content-android-media-scanner-and-download-manager-support)
2626
* [File access](#user-content-file-access)
2727
* [File stream](#user-content-file-stream)
28-
* [Manage cached files](#user-content-manage-cached-files)
28+
* [Manage cached files](#user-content-cache-file-management)
2929
* [Self-Signed SSL Server](#user-content-self-signed-ssl-server)
3030
* [API References](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API)
3131
* [Development](#user-content-development)
@@ -336,6 +336,8 @@ RNFetchBlob
336336

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

339+
<img src="img/download-manager.png" width="256">
340+
339341
When using DownloadManager, `fileCache` and `path` properties in `config` will not take effect, because Android DownloadManager can only store files to external storage. When download complete, DownloadManager will generate a file path so that you can deal with it.
340342

341343
```js
@@ -391,25 +393,25 @@ RNFetchBlob.config({
391393

392394
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 I realized that, it's hard to find a great solution to manage cached files, every one who use this moudle may need those APIs for there cases.
393395

394-
Here's the list of `fs` APIs
395-
396-
- dirs
397-
- createFile
398-
- readFile
399-
- writeFile
400-
- appendFile
401-
- readStream
402-
- writeStream
403-
- unlink
404-
- mkdir
405-
- ls
406-
- mv
407-
- cp
408-
- exists
409-
- isDir
410-
- lstat
411-
- stat
412-
- scanFile (Android Only)
396+
File Access APIs
397+
398+
- [dirs](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#dirs)
399+
- [createFile](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#createfilepath-data-encodingpromise)
400+
- [writeFile (0.6.0)](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#writefilepathstring-contentstring--array-encodingstring-appendbooleanpromise)
401+
- [appendFile (0.6.0) ](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#appendfilepathstring-contentstring--array-encodingstringpromise)
402+
- [readFile (0.6.0)](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#readfilepath-encodingpromise)
403+
- [readStream](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#readstreampath-encoding-buffersizepromise)
404+
- [writeStream](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#writestreampathstring-encodingstring-appendbooleanpromise)
405+
- [unlink](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#unlinkpathstringpromise)
406+
- [mkdir](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#mkdirpathstringpromise)
407+
- [ls](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#lspathstringpromise)
408+
- [mv](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#mvfromstring-tostringpromise)
409+
- [cp](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#cpsrcstring-deststringpromise)
410+
- [exists](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#existspathstringpromise)
411+
- [isDir](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#isdirpathstringpromise)
412+
- [stat](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#statpathstringpromise)
413+
- [lstat](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#lstatpathstringpromise)
414+
- [scanFile (Android only)](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#scanfilepathstringpromise-androi-only)
413415

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

0 commit comments

Comments
 (0)