|
|
|
|
2
|
[](https://github.com/wkh237/react-native-fetch-blob/releases) [](https://www.npmjs.com/package/react-native-fetch-blob)  [](https://github.com/wkh237/react-native-fetch-blob/wiki) []()
|
2
|
[](https://github.com/wkh237/react-native-fetch-blob/releases) [](https://www.npmjs.com/package/react-native-fetch-blob)  [](https://github.com/wkh237/react-native-fetch-blob/wiki) []()
|
3
|
|
3
|
|
4
|
|
4
|
|
5
|
-A project committed to making file access and data transfer easier, efficient for React Native developers.
|
|
|
6
|
-> For Firebase Storage solution, please upgrade to latest version for best compatibility.
|
|
|
|
|
5
|
+A project committed to making file access and data transfer easier and more efficient for React Native developers.
|
|
|
6
|
+> For Firebase Storage solution, please upgrade to the latest version for the best compatibility.
|
7
|
|
7
|
|
8
|
## Features
|
8
|
## Features
|
9
|
- Transfer data directly from/to storage without BASE64 bridging
|
9
|
- Transfer data directly from/to storage without BASE64 bridging
|
|
|
|
|
39
|
|
39
|
|
40
|
## About
|
40
|
## About
|
41
|
|
41
|
|
42
|
-This project was initially for solving the issue [facebook/react-native#854](https://github.com/facebook/react-native/issues/854) because React Native lack of `Blob` implementation and it's problematic when transferring binary data. Now the project is committed to making file access and transfer easier, efficient for React Native developers.
|
|
|
43
|
-We've implemented highly customizable filesystem and network module which plays well together. For example, upload and download data directly from/to storage which is much more efficient in some cases(especially for large ones). The file system supports file stream, so you don't have to worry about OOM problem when accessing large files.
|
|
|
|
|
42
|
+This project was initially created to solve the issue [facebook/react-native#854](https://github.com/facebook/react-native/issues/854) because React Native lacks any `Blob` implementation and is problematic when transferring binary data. The project is committed to making file access and transfer easier and more efficient for React Native developers.
|
|
|
43
|
+We've implemented highly customizable filesystem and network module which plays well together. For example, developers can upload and download data directly from/to storage, which is more efficient, especially for large files. The file system supports file stream, so you don't have to worry about OOM problem when accessing large files.
|
44
|
|
44
|
|
45
|
In `0.8.0` we introduced experimental Web API polyfills that make it possible to use browser-based libraries in React Native, such as, [FireBase JS SDK](https://github.com/wkh237/rn-firebase-storage-upload-sample)
|
45
|
In `0.8.0` we introduced experimental Web API polyfills that make it possible to use browser-based libraries in React Native, such as, [FireBase JS SDK](https://github.com/wkh237/rn-firebase-storage-upload-sample)
|
46
|
|
46
|
|
|
|
|
|
53
|
npm install --save react-native-fetch-blob
|
53
|
npm install --save react-native-fetch-blob
|
54
|
```
|
54
|
```
|
55
|
|
55
|
|
56
|
-Or if using CocoaPods, add the pod to your `Podfile`, for example:
|
|
|
|
|
56
|
+Or if using CocoaPods, add the pod to your `Podfile`
|
57
|
|
57
|
|
58
|
```
|
58
|
```
|
59
|
pod 'react-native-fetch-blob',
|
59
|
pod 'react-native-fetch-blob',
|
|
|
|
|
68
|
```
|
68
|
```
|
69
|
**Automatically Link Native Modules**
|
69
|
**Automatically Link Native Modules**
|
70
|
|
70
|
|
71
|
-For 0.29.2+ projects, simply link native packages via the following command because rnpm has been merged into react-native, you no longer need it.
|
|
|
|
|
71
|
+For 0.29.2+ projects, simply link native packages via the following command (note: rnpm has been merged into react-native)
|
72
|
|
72
|
|
73
|
```
|
73
|
```
|
74
|
react-native link
|
74
|
react-native link
|
|
|
|
|
115
|
|
115
|
|
116
|
```
|
116
|
```
|
117
|
|
117
|
|
118
|
-Also, if you're going to use `Android Download Manager` you have to add this to `AndroidManifetst.xml`
|
|
|
|
|
118
|
+Also, if you're going to use `Android Download Manager` you have to add this to `AndroidManifest.xml`
|
119
|
|
119
|
|
120
|
```diff
|
120
|
```diff
|
121
|
<intent-filter>
|
121
|
<intent-filter>
|
|
|
|
|
152
|
|
152
|
|
153
|
### Regular Request
|
153
|
### Regular Request
|
154
|
|
154
|
|
155
|
-After `0.8.0` react-native-fetch-blob automatically decide how to send the body by checking its type and `Content-Type` in the header. The rule is described in the following diagram
|
|
|
|
|
155
|
+After `0.8.0` react-native-fetch-blob automatically decides how to send the body by checking its type and `Content-Type` in the header. The rule is described in the following diagram
|
156
|
|
156
|
|
157
|
<img src="img/RNFB-flow (1).png" style="width : 90%" />
|
157
|
<img src="img/RNFB-flow (1).png" style="width : 90%" />
|
158
|
|
158
|
|