|
@@ -2,20 +2,9 @@
|
2
|
2
|
|
3
|
3
|
A module provides upload, download, and files access API. Supports file stream read/write for process large files.
|
4
|
4
|
|
5
|
|
-**Rationale**
|
6
|
|
-
|
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 [facebook/react-native#854](https://github.com/facebook/react-native/issues/854).
|
8
|
|
-
|
9
|
|
-For some use 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 APIs provided 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 stored to a file directly so that you can read it by using file access APIs such as readFile, readStream.
|
10
|
|
-
|
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
|
|
-
|
13
|
|
-**Backward Compatible**
|
14
|
|
-
|
15
|
|
-All updates are `backward-compatible` generally you don't have to change existing code unless you're going to use new APIs. But we recommend pre `0.5.0` users consider upgrade the package to latest version, since we have introduced new APIs can either `upload` or `download` files simply using a file path. It's much more memory efficent in some use case. We've also introduced `fs` APIs for access files, and `file stream` API that helps you read/write files (especially for **large ones**), see [Examples](#user-content-recipes) bellow. This module implements native methods, supports both Android (uses awesome native library [AsyncHttpClient](https://github.com/AsyncHttpClient/async-http-client])) and IOS.
|
16
|
|
-
|
17
|
5
|
## TOC
|
18
|
|
-
|
|
6
|
+* [About](#user-content-about)
|
|
7
|
+* [Backward Compatible](#user-content-backward-compatible)
|
19
|
8
|
* [Installation](#user-content-installation)
|
20
|
9
|
* [Recipes](#user-content-recipes)
|
21
|
10
|
* [Download file](#user-content-download-example--fetch-files-that-needs-authorization-token)
|
|
@@ -28,7 +17,20 @@ All updates are `backward-compatible` generally you don't have to change existin
|
28
|
17
|
* [Manage cached files](#user-content-cache-file-management)
|
29
|
18
|
* [Self-Signed SSL Server](#user-content-self-signed-ssl-server)
|
30
|
19
|
* [API References](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API)
|
|
20
|
+* [Trouble Shooting](https://github.com/wkh237/react-native-fetch-blob/wiki/Trouble-Shooting)
|
31
|
21
|
* [Development](#user-content-development)
|
|
22
|
+
|
|
23
|
+## About
|
|
24
|
+
|
|
25
|
+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 [facebook/react-native#854](https://github.com/facebook/react-native/issues/854).
|
|
26
|
+
|
|
27
|
+For some use 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 APIs provided 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 stored to a file directly so that you can read it by using file access APIs such as readFile, readStream.
|
|
28
|
+
|
|
29
|
+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.
|
|
30
|
+
|
|
31
|
+## Backward Compatible
|
|
32
|
+
|
|
33
|
+All updates are `backward-compatible` generally you don't have to change existing code unless you're going to use new APIs. But we recommend pre `0.5.0` users consider upgrade the package to latest version, since we have introduced new APIs can either `upload` or `download` files simply using a file path. It's much more memory efficent in some use case. We've also introduced `fs` APIs for access files, and `file stream` API that helps you read/write files (especially for **large ones**), see [Examples](#user-content-recipes) bellow. This module implements native methods, supports both Android (uses awesome native library [AsyncHttpClient](https://github.com/AsyncHttpClient/async-http-client])) and IOS.
|
32
|
34
|
|
33
|
35
|
## Installation
|
34
|
36
|
|
|
@@ -63,6 +65,7 @@ protected List<ReactPackage> getPackages() {
|
63
|
65
|
};
|
64
|
66
|
...
|
65
|
67
|
```
|
|
68
|
+> If you still having problem on installing this package, please check the [trouble shooting page](https://github.com/wkh237/react-native-fetch-blob/wiki/Trouble-Shooting) or [file an issue](https://github.com/wkh237/react-native-fetch-blob/issues/new)
|
66
|
69
|
|
67
|
70
|
**Grant Permission to External storage for Android 5.0 or lower**
|
68
|
71
|
|