Browse Source

Change README.md in src folder

Ben Hsieh 8 years ago
parent
commit
ea478fa071
1 changed files with 27 additions and 25 deletions
  1. 27
    25
      src/README.md

+ 27
- 25
src/README.md View File

@@ -4,11 +4,11 @@ A module provides upload, download, and files access API. Supports file stream r
4 4
 
5 5
 **Why do we need this**
6 6
 
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).
8 8
 
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.
10 10
 
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.
12 12
 
13 13
 **Pre v0.5.0 Users**
14 14
 
@@ -21,11 +21,11 @@ This update is `backward-compatible` generally you don't have to change existing
21 21
  * [Download file](#user-content-download-example--fetch-files-that-needs-authorization-token)
22 22
  * [Upload file](#user-content-upload-example--dropbox-files-upload-api)
23 23
  * [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)
26 26
  * [File access](#user-content-file-access)
27 27
  * [File stream](#user-content-file-stream)
28
- * [Manage cached files](#user-content-manage-cached-files)
28
+ * [Manage cached files](#user-content-cache-file-management)
29 29
  * [Self-Signed SSL Server](#user-content-self-signed-ssl-server)
30 30
 * [API References](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API)
31 31
 * [Development](#user-content-development)
@@ -336,6 +336,8 @@ RNFetchBlob
336 336
 
337 337
 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.
338 338
 
339
+<img src="img/download-manager.png" width="256">
340
+
339 341
 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.
340 342
 
341 343
 ```js
@@ -391,25 +393,25 @@ RNFetchBlob.config({
391 393
 
392 394
 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.
393 395
 
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)
413 415
 
414 416
 See [File API](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API) for more information
415 417