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

Commit cda9a6f

Browse files
committed
Merge branch '0.9.0' of github.com:wkh237/react-native-fetch-blob into 0.9.0
2 parents b9fe581 + e3de593 commit cda9a6f

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ A project committed to make file acess and data transfer easier, effiecient for
99
- File stream support for dealing with large file
1010
- Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
1111

12+
1213
## TOC
1314
* [About](#user-content-about)
1415
* [Installation](#user-content-installation)
@@ -38,6 +39,7 @@ This project was initially for solving the issue [facebook/react-native#854](htt
3839

3940
In `0.8.0` we introduced experimential Web API polyfills that make it possible to use browser-based libraries in React Native, for example, [FireBase JS SDK](https://github.com/wkh237/rn-firebase-storage-upload-sample)
4041

42+
4143
## Installation
4244

4345
Install package from npm
@@ -493,6 +495,38 @@ RNFetchBlob.config({
493495
.then(...)
494496
```
495497

498+
**Open Downloaded File with Intent**
499+
500+
This is a new feature added in `0.9.0`, if you're going to open a file path using official [Linking](https://facebook.github.io/react-native/docs/linking.html) API that might not work as expected, also, if you're going to install an APK in `Downloads` app, that will not work too. As an alternative, you can try `actionViewIntent` API, which will send an ACTION_VIEW intent for you which uses the given `MIME` type.
501+
502+
Download and install an APK programatically
503+
504+
```js
505+
506+
const android = RNFetchBlob.android
507+
508+
RNFetchBlob.config({
509+
addAndroidDownloads : {
510+
useDownloadManager : true,
511+
title : 'awesome.apk',
512+
description : 'An APK that will be installed',
513+
mime : 'application/vnd.android.package-archive',
514+
mediaScannable : true,
515+
notification : true,
516+
}
517+
})
518+
.fetch('GET', `http://www.example.com/awesome.apk`)
519+
.then((res) => {
520+
android.actionViewIntent(res.path(), 'application/vnd.android.package-archive')
521+
})
522+
```
523+
524+
Or show an image in image viewer
525+
526+
```js
527+
android.actionViewIntent(PATH_OF_IMG, 'image/png')
528+
```
529+
496530
### File System
497531

498532
#### File Access
@@ -645,7 +679,7 @@ RNFetchBlob.config({
645679

646680
### Web API Polyfills
647681

648-
After `0.8.0` we've made some [Web API polyfills](https://github.com/wkh237/react-native-fetch-blob/wiki/Web-API-Polyfills-(work-in-progress)) that makes some browser-based library available in RN.
682+
After `0.8.0` we've made some [Web API polyfills](https://github.com/wkh237/react-native-fetch-blob/wiki/Web-API-Polyfills-(experimental)) that makes some browser-based library available in RN.
649683

650684
- Blob
651685
- XMLHttpRequest (Use our implementation if you're going to use it with Blob)
@@ -676,7 +710,7 @@ If you're going to concatenate files, you don't have to read the data to JS cont
676710

677711
| Version | |
678712
|---|---|
679-
| 0.8.2 | Fix Android RN 0.31 installation issue #78 |
713+
| 0.9.0 | Fix unicode response data format issue #73. Improve Android performance by using thread pool instead of async task. Add Fetch replacement #70. Add Android only API `actionViewIntent` to open file or install APK in app |
680714
| 0.8.1 | Remove Web API log and fix ios progress report function. |
681715
| 0.8.0 | Added Web API polyfills, support regular request, added timeout option. |
682716
| 0.7.5 | Fix installation script that make it compatible to react-native < 0.28 |

0 commit comments

Comments
 (0)