You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+29-8Lines changed: 29 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,15 @@
2
2
3
3
## v0.5.0 Work In Progress README.md
4
4
5
-
Module for upload, download, and files access in JS context. Supports file stream read/write for process large files.
5
+
A module provides upload, download, and files access API. Supports file stream read/write for process large files.
6
6
7
7
**Why do we need this**
8
8
9
9
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).
10
10
11
-
Therefore you may getting into trouble sometime. For example, you're going to display an image but the file server requires a specific field(for example, "Authorization") in headers or body, 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 data. It 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.
11
+
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. It 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.
12
12
13
-
This module is designed for these kind of purpose, and also be a substitution of `blob`, so there's a set of file access API added after `v0.5.0`, including basic CRUD method, and file stream reader and writer.
13
+
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.
14
14
15
15
**Pre v0.5.0 Users**
16
16
@@ -19,12 +19,12 @@ This update is `backward-compatible` generally you don't have to change existing
@@ -69,7 +69,7 @@ If you're going to access external storage (say, SD card storage), you might hav
69
69
70
70
```
71
71
72
-
## Usage
72
+
## Guide
73
73
74
74
```js
75
75
importRNFetchBlobfrom'react-native-fetch-blob'
@@ -296,9 +296,29 @@ In `version >= 0.4.2` it is possible to know the upload/download progress.
296
296
})
297
297
```
298
298
299
-
#### Show Downloaded File and Notifiction in Android Downloads App
299
+
#### Android Media Scanner, and Downloads App Support
300
300
301
-
When you use `config` API to store response data to file, the file won't be visible in Andoird's "Download" app, if you want to do this, some extra options in `config` is required.
301
+
If you want to make a file in `External Storage` becomes visible in Picture, Misuc, or other built-in apps, you will have to use `Media Scanner`. To make this happend, use `scanFile` method in `fs`.
If mime is null or undefined, then the mime type will be inferred from the file extension.
318
+
319
+
**Download Notification and Visibiliy in Download App**
320
+
321
+
Generally, when you store a file into
302
322
303
323
```js
304
324
RNFetchBlob.config({
@@ -320,6 +340,7 @@ RNFetchBlob.config({
320
340
.then(...)
321
341
```
322
342
343
+
323
344
#### File Access
324
345
325
346
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.
0 commit comments