react-native-fetch-api
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,2 +5,9 @@ # Changelog | ||
### [1.0.1](https://github.com/react-native-community/fetch/compare/v1.0.0...v1.0.1) (2021-01-25) | ||
### Bug Fixes | ||
* handle blobs as stream when FileReader.readAsArrayBuffer is available ([6ebb08a](https://github.com/react-native-community/fetch/commit/6ebb08a9093888a8c3f1839cdec22b4728a0b033)) | ||
## 1.0.0 (2021-01-25) |
{ | ||
"name": "react-native-fetch-api", | ||
"description": "A fetch API polyfill for React Native with text streaming support.", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "fetch.js", | ||
"author": "André Costa Lima <andreclima.pt@gmail.com> (https://github.com/acostalima/)", | ||
"author": { | ||
"name": "André Costa Lima", | ||
"email": "andreclima.pt@gmail.com", | ||
"url": "https://github.com/acostalima/" | ||
}, | ||
"repository": "react-native-community/fetch", | ||
@@ -33,5 +37,8 @@ "license": "MIT", | ||
"querystring": "^0.2.0", | ||
"react-native-polyfill-globals": "^1.0.7", | ||
"react-native-polyfill-globals": "^2.0.0", | ||
"react-native-test-runner": "^2.0.0", | ||
"react-native-url-polyfill": "^1.2.0", | ||
"standard-version": "^9.1.0", | ||
"text-encoding": "^0.7.0", | ||
"web-streams-polyfill": "^3.0.1", | ||
"zora": "^4.0.2" | ||
@@ -38,0 +45,0 @@ }, |
import BlobManager from "react-native/Libraries/Blob/BlobManager"; | ||
import Response from "./Response"; | ||
// import { createBlobReader } from "./utils"; | ||
import { createBlobReader } from "./utils"; | ||
@@ -10,12 +10,15 @@ class StreamBlobResponse { | ||
this._blobResponse = new Response(blob, options); | ||
// this._streamResponse = new Response(stream, options); | ||
// return createBlobReader(blob) | ||
// .readAsArrayBuffer() | ||
// .then((arrayBuffer) => { | ||
// this._arrayBufferResponse = new Response(arrayBuffer, options); | ||
// streamController.enqueue(new Uint8Array(arrayBuffer)); | ||
return createBlobReader(blob) | ||
.readAsArrayBuffer() | ||
.then((arrayBuffer) => { | ||
this._streamResponse = new Response(stream, options); | ||
this._arrayBufferResponse = new Response(arrayBuffer, options); | ||
streamController.enqueue(new Uint8Array(arrayBuffer)); | ||
// return this; | ||
// }); | ||
return this; | ||
}) | ||
.catch(() => { | ||
return this; | ||
}); | ||
} | ||
@@ -22,0 +25,0 @@ |
@@ -13,7 +13,7 @@ function createBlobReader(blob) { | ||
return { | ||
readAsArrayBuffer: () => { | ||
readAsArrayBuffer: async () => { | ||
reader.readAsArrayBuffer(blob); | ||
return fileReaderReady; | ||
}, | ||
readAsText: () => { | ||
readAsText: async () => { | ||
reader.readAsText(blob); | ||
@@ -20,0 +20,0 @@ return fileReaderReady; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41818
790
25