react-native-fetch-blob
Advanced tools
Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "react-native-fetch-blob", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "A react-native plugin for fetch blob data via HTTP.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,28 +24,2 @@ # react-native-fetch-blob | ||
## API | ||
#### `Promise<FetchBlobResponse> fetch(url, headers, body)` | ||
Send a HTTP request uses given headers and body, and return a Promise. | ||
#### url:`string` Required | ||
HTTP request destination url. | ||
#### headers:`object` (Optional) | ||
Headers of HTTP request, value of headers should be `stringified`. | ||
#### body:`string` (Optional) | ||
Body of the HTTP request, body MUST be a BASE64 string, this string will be converted into byte array in native code. | ||
### FetchBlobResponse | ||
When `fetch` success, it resolve a `FetchBlobResponse` object as first argument. `FetchBlobResponse` object has the following methods (these method are synchronous, so you might take quite a performance impact if the file is big): | ||
#### base64():string | ||
returns base64 string of response data (done in native context) | ||
#### json():object | ||
returns json parsed object (done in js context) | ||
#### text():string | ||
returns decoded base64 string (done in js context) | ||
#### blob():Blob | ||
returns Blob object (one in js context) | ||
## Usage | ||
@@ -105,2 +79,28 @@ | ||
## API | ||
#### `Promise<FetchBlobResponse> fetch(url, headers, body)` | ||
Send a HTTP request uses given headers and body, and return a Promise. | ||
#### url:`string` Required | ||
HTTP request destination url. | ||
#### headers:`object` (Optional) | ||
Headers of HTTP request, value of headers should be `stringified`. | ||
#### body:`string` (Optional) | ||
Body of the HTTP request, body MUST be a BASE64 string, this string will be converted into byte array in native code. | ||
### FetchBlobResponse | ||
When `fetch` success, it resolve a `FetchBlobResponse` object as first argument. `FetchBlobResponse` object has the following methods (these method are synchronous, so you might take quite a performance impact if the file is big): | ||
#### base64():string | ||
returns base64 string of response data (done in native context) | ||
#### json():object | ||
returns json parsed object (done in js context) | ||
#### text():string | ||
returns decoded base64 string (done in js context) | ||
#### blob():Blob | ||
returns Blob object (one in js context) | ||
### TODO | ||
@@ -107,0 +107,0 @@ |
57576
19