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

Commit aea70e6

Browse files
committed
Merge branch '0.6.2'
2 parents 5cdfdea + c96b3d0 commit aea70e6

30 files changed

+1239
-253
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ Elements have property `filename` will be transformed into binary format, otherw
256256
})
257257
```
258258

259-
What if you want to upload a file in some field ? Just like [upload a file from storage](#user-content-upload-a-file-from-storage) example, wrap `data` by `wrap` API (this feature is only available for `version >= v0.5.0`)
259+
What if you want to upload a file in some field ? Just like [upload a file from storage](#user-content-upload-a-file-from-storage) example, wrap `data` by `wrap` API (this feature is only available for `version >= v0.5.0`). On version >= `0.6.2`, it is possible to set custom MIME type when appending file to form data.
260260

261261
```js
262262

@@ -274,6 +274,14 @@ What if you want to upload a file in some field ? Just like [upload a file from
274274
// Or simply wrap the file path with RNFetchBlob.wrap().
275275
data: RNFetchBlob.wrap(PATH_TO_THE_FILE)
276276
},
277+
{
278+
name : 'ringtone',
279+
filename : 'ring.mp3',
280+
// use custom MIME type
281+
type : 'application/mp3',
282+
// upload a file from asset is also possible in version >= 0.6.2
283+
data : RNFetchBlob.wrap(RNFetchBlob.fs.asset('default-ringtone.mp3'))
284+
}
277285
// elements without property `filename` will be sent as plain text
278286
{ name : 'name', data : 'user'},
279287
{ name : 'info', data : JSON.stringify({
@@ -289,7 +297,7 @@ What if you want to upload a file in some field ? Just like [upload a file from
289297

290298
#### Upload/Download progress
291299

292-
In `version >= 0.4.2` it is possible to know the upload/download progress.
300+
In `version >= 0.4.2` it is possible to know the upload/download progress. On Anroid, only download progress is supported. See [wiki](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API#fetchprogresseventlistenerpromisernfetchblobresponse) for more information.
293301

294302
```js
295303
RNFetchBlob.fetch('POST', 'http://www.example.com/upload', {
@@ -391,10 +399,12 @@ RNFetchBlob.config({
391399

392400
#### File Access
393401

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.
402+
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 we realized that, it's hard to find a great solution to manage cached files, every one who use this moudle may need these APIs for there cases.
395403

396-
File Access APIs
404+
Before get started using file APIs we recommend read [Differences between File Source](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#differences-between-file-source) first.
397405

406+
File Access APIs
407+
- [asset (0.6.2)](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#assetfilenamestringstring)
398408
- [dirs](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#dirs)
399409
- [createFile](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#createfilepath-data-encodingpromise)
400410
- [writeFile (0.6.0)](https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API#writefilepathstring-contentstring--array-encodingstring-appendbooleanpromise)
@@ -539,6 +549,7 @@ RNFetchBlob.config({
539549

540550
| Version | |
541551
|---|---|
552+
| 0.6.2 | Add support of asset file and camera roll files, Support custom MIME type when sending multipart request, thanks @smartt |
542553
| 0.6.1 | Fix #37 progress report API issue on IOS |
543554
| 0.6.0 | Add readFile and writeFile API for easier file access, also added Android download manager support. |
544555
| 0.5.8 | Fix #33 PUT request will always be sent as POST on Android |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fetchblob",
3-
"version": "0.6.1",
3+
"version": "0.6.2",
44
"private": true,
55
"scripts": {
66
"start": "node node_modules/react-native/local-cli/cli.js start",

src/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
public class RNFetchBlob extends ReactContextBaseJavaModule {
1414

1515
String filePathPrefix = "RNFetchBlob-file://";
16+
static ReactApplicationContext RCTContext;
1617

1718
public RNFetchBlob(ReactApplicationContext reactContext) {
19+
1820
super(reactContext);
21+
RCTContext = reactContext;
1922
}
2023

2124
@Override

0 commit comments

Comments
 (0)