rn-fetch-blob
Advanced tools
Comparing version 0.10.14 to 0.10.15
{ | ||
"name": "rn-fetch-blob", | ||
"version": "0.10.14", | ||
"version": "0.10.15", | ||
"description": "A module provides upload, download, and files access API. Supports file stream read/write for process large files.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -32,3 +32,2 @@ # New Releases | ||
* [Cancel HTTP request](#user-content-cancel-request) | ||
* [iOS Background Uploading](#user-content-ios-background-uploading) | ||
* [Android Media Scanner, and Download Manager Support](#user-content-android-media-scanner-and-download-manager-support) | ||
@@ -480,30 +479,2 @@ * [Self-Signed SSL Server](#user-content-self-signed-ssl-server) | ||
### iOS Background Uploading | ||
Normally, iOS interrupts network connections when an app is moved to the background, and will throw an error 'Lost connection to background transfer service' when the app resumes. To continue the upload of large files even when the app is in the background, you will need to enable IOSUploadTask options. | ||
First add the following property to your AppDelegate.h: | ||
``` | ||
@property (nonatomic, copy) void(^backgroundTransferCompletionHandler)(); | ||
``` | ||
Then add the following to your AppDelegate.m: | ||
``` | ||
- (void)application:(UIApplication *)application | ||
handleEventsForBackgroundURLSession:(NSString *)identifier | ||
completionHandler:(void (^)(void))completionHandler { | ||
self.backgroundTransferCompletionHandler = completionHandler; | ||
} | ||
``` | ||
The following example shows how to upload a file in the background: | ||
```js | ||
RNFetchBlob | ||
.config({ | ||
IOSBackgroundTask: true, // required for both upload | ||
IOSUploadTask: true, // Use instead of IOSDownloadTask if uploading | ||
uploadFilePath : 'file://' + filePath | ||
}) | ||
.fetch('PUT', url, { | ||
'Content-Type': mediaType | ||
}, RNFetchBlob.wrap(filePath)); | ||
``` | ||
### Android Media Scanner, and Download Manager Support | ||
@@ -510,0 +481,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2968943
852