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

Commit 63bcc8d

Browse files
committed
Merge branch '0.10.1' into 0.11.0
2 parents e278660 + 6cfeb7e commit 63bcc8d

19 files changed

+157
-50
lines changed

.github/ISSUE_TEMPLATE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hi ! Thank you for reporting an issue, but we would like to remind you, we have a trouble shooting page in our wiki. You may want to take a look on that page :p
1+
Hi ! Thank you for reporting an issue, but we would like to remind you, we have a trouble shooting page in our wiki. You may want to take a look on that page or find issues tagged "trouble shooting" :p
22

33
* please provide the version of installed library and RN project.
44
* a sample code snippet/repository is very helpful to spotting the problem.

.github/PULL_REQUEST_TEMPLATE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Thank you for making a pull request ! Just a gentle reminder :)
22

3-
1. If the PR is offering a feature please make the request to our "Feature Branch" 0.10.0
4-
2. Bug fix request to "Bug Fix Branch" 0.10.0
3+
1. If the PR is offering a feature please make the request to our "Feature Branch" 0.11.0
4+
2. Bug fix request to "Bug Fix Branch" 0.10.1
55
3. Correct README.md can directly to master

CONTRIBUTORS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
Andreas Amsenius <[email protected]>
2+
Arthur Ouaki <[email protected]>
3+
Binur Konarbai <[email protected]>
4+
Chris Sloey <[email protected]>
25
Corentin Smith <[email protected]>
36
Dmitry Petukhov <[email protected]>
47
Erik Smartt <[email protected]>
58
Evgeniy Baraniuk <[email protected]>
9+
Frank van der Hoek <[email protected]>
610
Juan B. Rodriguez <[email protected]>
711
812
Mike Monteith <[email protected]>
913
Nguyen Cao Nhat Linh <[email protected]>
1014
Tim Suchanek <[email protected]>
1115
1216
francisco-sanchez-molina <[email protected]>
17+
1318
kejinliang <[email protected]>
19+
pedramsaleh <[email protected]>
1420

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44

55
A project committed to make file acess and data transfer easier, efficient for React Native developers.
66

7-
> The npm package is inside `src` folder, if you're going to install using github repository do not point to here directly
7+
> If you're going to use github repo as npm dependency please use the [archive repository](https://github.com/wkh237/react-native-fetch-blob-package/releases/tag/v0.9.6).
8+
9+
> If you're using this library as Firebase Storage solution, please upgrade to 0.9.6 since XMLHttpRequest polyfill has way better compatibility than previous versions.
810
911
## Features
1012
- Transfer data directly from/to storage without BASE64 bridging
1113
- File API supports normal files, Asset files, and CameraRoll files
1214
- Native-to-native file manipulation API, reduce JS bridging performance loss
1315
- File stream support for dealing with large file
1416
- Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
17+
- JSON stream supported base on [Oboe.js@jimhigson](https://github.com/jimhigson/oboe.js/)
1518

1619
## TOC
1720
* [About](#user-content-about)
@@ -34,7 +37,7 @@ A project committed to make file acess and data transfer easier, efficient for R
3437
* [Web API Polyfills](#user-content-web-api-polyfills)
3538
* [Performance Tips](#user-content-performance-tips)
3639
* [API References](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API)
37-
* [Trouble Shooting](https://github.com/wkh237/react-native-fetch-blob/wiki/Trouble-Shooting)
40+
* [Caveats](#user-content-caveats)
3841
* [Development](#user-content-development)
3942

4043
## About
@@ -55,8 +58,8 @@ npm install --save react-native-fetch-blob
5558
Or if using CocoaPods, add the pod to your `Podfile`, for example:
5659

5760
```
58-
pod 'react-native-fetch-blob,
59-
:path => '../node_modules/react-native-fetch-blob
61+
pod 'react-native-fetch-blob',
62+
:path => '../node_modules/react-native-fetch-blob'
6063
```
6164

6265
**Automatically Link Native Modules**
@@ -403,7 +406,7 @@ In `version >= 0.4.2` it is possible to know the upload/download progress. After
403406
})
404407
```
405408

406-
In `0.9.6`, you can specify an optional first argument which contains `count` and `interval` to limit progress event frequency (this will be done in native context in order to reduce RCT bridge overhead). Notice that `count` argument will not work if the server does not provide response content length.
409+
In `0.9.6`, you can specify an object as first argument which contains `count` and `interval`, to the frequency of progress event (this will be done in native context in order to reduce RCT bridge overhead). Notice that `count` argument will not work if the server does not provide response content length.
407410

408411

409412
```js
@@ -429,7 +432,7 @@ In `0.9.6`, you can specify an optional first argument which contains `count` an
429432

430433
### Cancel Request
431434

432-
After `0.7.0` it is possible to cancel a HTTP request. When the request cancel, it will definately throws an promise rejection, be sure to catch it.
435+
After `0.7.0` it is possible to cancel an HTTP request. When the request is cancelled, it will throw a promise rejection, be sure to catch it.
433436

434437
```js
435438
let task = RNFetchBlob.fetch('GET', 'http://example.com/file/1')
@@ -735,7 +738,7 @@ Here's a [sample app](https://github.com/wkh237/rn-firebase-storage-upload-sampl
735738

736739
## Performance Tips
737740

738-
**Read Stream Event Overhead**
741+
**Read Stream and Progress Event Overhead**
739742

740743
When reading data via `fs.readStream` the process seems blocking JS thread when file is large, it's because the default buffer size is quite small (4kb) which result in large amount of events triggered in JS thread, try to increase the buffer size (for example 100kb = 102400) and set a larger interval (which is introduced in 0.9.4 default value is 10ms) to limit the frequency.
741744

@@ -757,6 +760,16 @@ If you're going to concatenate files, you don't have to read the data to JS cont
757760

758761
<img src="img/performance_f2f.png" style="width : 100%"/>
759762

763+
## Caveats
764+
765+
* This library does not urlencode unicode characters in URL automatically, see [#146](https://github.com/wkh237/react-native-fetch-blob/issues/146).
766+
* When a `Blob` is created from existing file, the file **WILL BE REMOVE** if you `close` the blob.
767+
* If you replaced `window.XMLHttpRequest` for some reason (e.g. make Firebase SDK work), it will also effect how official `fetch` works (basically it should work just fine).
768+
* When file stream and upload/download progress event slow down your app, consider upgrade to `0.9.6+`, use [additional arguments](https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API#fetchprogressconfig-eventlistenerpromisernfetchblobresponse) to limit its frequency.
769+
* When passing a file path to the library, remove `file://` prefix.
770+
771+
when you got problem, have a look at [Trouble Shooting](https://github.com/wkh237/react-native-fetch-blob/wiki/Trouble-Shooting) or [issues labeled Trouble Shooting](https://github.com/wkh237/react-native-fetch-blob/issues?utf8=✓&q=label%3A%22trouble%20shooting%22%20), there'd be some helpful information.
772+
760773
## Changes
761774

762775
See [release notes](https://github.com/wkh237/react-native-fetch-blob/releases)

img/action-menu.png

69.5 KB
Loading

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "react-native-fetch-blob-dev-env",
33
"description": "RNFB development environment, not dist package",
4-
"version": "0.10.0-dev",
4+
"version": "0.10.1-dev",
55
"private": true,
66
"scripts": {
77
"start": "node node_modules/react-native/local-cli/cli.js start",
88
"update-info": "sh scripts/contributors.sh",
9-
"test": "sh test.sh"
9+
"test": "sh ./scrips/test.sh"
1010
},
1111
"devDependencies": {
1212
"body-parser": "^1.15.0",
@@ -17,19 +17,25 @@
1717
},
1818
"contributors": [
1919
"Andreas Amsenius <[email protected]>",
20+
"Arthur Ouaki <[email protected]>",
21+
"Binur Konarbai <[email protected]>",
22+
"Chris Sloey <[email protected]>",
2023
"Corentin Smith <[email protected]>",
2124
"Dmitry Petukhov <[email protected]>",
2225
"Erik Smartt <[email protected]>",
2326
"Evgeniy Baraniuk <[email protected]>",
27+
"Frank van der Hoek <[email protected]>",
2428
"Juan B. Rodriguez <[email protected]>",
2529
"Kaishley <[email protected]>",
2630
"Mike Monteith <[email protected]>",
2731
"Nguyen Cao Nhat Linh <[email protected]>",
2832
"Tim Suchanek <[email protected]>",
2933
"follower <[email protected]>",
3034
"francisco-sanchez-molina <[email protected]>",
35+
"hhravn <[email protected]>",
3136
"kejinliang <[email protected]>",
37+
"pedramsaleh <[email protected]>",
3238
"smartt <[email protected]>",
3339
""
3440
]
35-
}
41+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private File createMultipartBodyCache() throws IOException {
196196
// form begin
197197
String header = "--" + boundary + "\r\n";
198198
if (field.filename != null) {
199-
header += "Content-Disposition: form-data; name=" + name + "; filename=" + field.filename + "\r\n";
199+
header += "Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + field.filename + "\"\r\n";
200200
header += "Content-Type: " + field.mime + "\r\n\r\n";
201201
os.write(header.getBytes());
202202
// file field header end
@@ -235,7 +235,7 @@ private File createMultipartBodyCache() throws IOException {
235235
}
236236
// data field
237237
else {
238-
header += "Content-Disposition: form-data; name=" + name + "\r\n";
238+
header += "Content-Disposition: form-data; name=\"" + name + "\"\r\n";
239239
header += "Content-Type: " + field.mime + "\r\n\r\n";
240240
os.write(header.getBytes());
241241
byte[] fieldData = field.data.getBytes();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ private void done(Response resp) {
513513
}
514514
break;
515515
}
516-
if(!resp.isSuccessful())
516+
// if(!resp.isSuccessful())
517517
resp.body().close();
518518
releaseTaskResource();
519519
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ public RNFetchBlobFileResp(ReactApplicationContext ctx, String taskId, ResponseB
4646
path = path.replace("?append=true", "");
4747
mPath = path;
4848
File f = new File(path);
49+
50+
File parent = f.getParentFile();
51+
if(!parent.exists() && !parent.mkdirs()){
52+
throw new IllegalStateException("Couldn't create dir: " + parent);
53+
}
54+
4955
if(f.exists() == false)
5056
f.createNewFile();
5157
ofStream = new FileOutputStream(new File(path), appendToExistingFile);

src/ios/RNFetchBlobReqBuilder.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@
2929
body:(NSString *)body
3030
onComplete:(void(^)(NSURLRequest * req, long bodyLength))onComplete;
3131

32-
+(void) buildEncodedRequest:(NSDictionary *)options
33-
taskId:(NSString *)taskId
34-
method:(NSString *)method
35-
url:(NSString *)url
36-
headers:(NSDictionary *)headers
37-
form:(NSString *)body
38-
onComplete:(void(^)(__weak NSURLRequest * req, long bodyLength))onComplete;
39-
4032
+(NSString *) getHeaderIgnoreCases:(NSString *)field fromHeaders:(NSMutableArray *) headers;
4133

4234

0 commit comments

Comments
 (0)