@smithy/fetch-http-handler
Advanced tools
Comparing version 2.5.0 to 3.0.0
@@ -179,16 +179,21 @@ var __defProp = Object.defineProperty; | ||
async function collectStream(stream) { | ||
let res = new Uint8Array(0); | ||
const chunks = []; | ||
const reader = stream.getReader(); | ||
let isDone = false; | ||
let length = 0; | ||
while (!isDone) { | ||
const { done, value } = await reader.read(); | ||
if (value) { | ||
const prior = res; | ||
res = new Uint8Array(prior.length + value.length); | ||
res.set(prior); | ||
res.set(value, prior.length); | ||
chunks.push(value); | ||
length += value.length; | ||
} | ||
isDone = done; | ||
} | ||
return res; | ||
const collected = new Uint8Array(length); | ||
let offset = 0; | ||
for (const chunk of chunks) { | ||
collected.set(chunk, offset); | ||
offset += chunk.length; | ||
} | ||
return collected; | ||
} | ||
@@ -195,0 +200,0 @@ __name(collectStream, "collectStream"); |
@@ -14,16 +14,21 @@ import { fromBase64 } from "@smithy/util-base64"; | ||
async function collectStream(stream) { | ||
let res = new Uint8Array(0); | ||
const chunks = []; | ||
const reader = stream.getReader(); | ||
let isDone = false; | ||
let length = 0; | ||
while (!isDone) { | ||
const { done, value } = await reader.read(); | ||
if (value) { | ||
const prior = res; | ||
res = new Uint8Array(prior.length + value.length); | ||
res.set(prior); | ||
res.set(value, prior.length); | ||
chunks.push(value); | ||
length += value.length; | ||
} | ||
isDone = done; | ||
} | ||
return res; | ||
const collected = new Uint8Array(length); | ||
let offset = 0; | ||
for (const chunk of chunks) { | ||
collected.set(chunk, offset); | ||
offset += chunk.length; | ||
} | ||
return collected; | ||
} | ||
@@ -30,0 +35,0 @@ function readToBase64(blob) { |
{ | ||
"name": "@smithy/fetch-http-handler", | ||
"version": "2.5.0", | ||
"version": "3.0.0", | ||
"description": "Provides a way to make requests", | ||
@@ -16,3 +16,3 @@ "scripts": { | ||
"extract:docs": "api-extractor run --local", | ||
"test": "yarn g:jest --coverage --forceExit && karma start karma.conf.js" | ||
"test": "yarn g:jest --coverage --forceExit && yarn g:karma start karma.conf.js" | ||
}, | ||
@@ -28,31 +28,14 @@ "author": { | ||
"dependencies": { | ||
"@smithy/protocol-http": "^3.3.0", | ||
"@smithy/querystring-builder": "^2.2.0", | ||
"@smithy/types": "^2.12.0", | ||
"@smithy/util-base64": "^2.3.0", | ||
"@smithy/protocol-http": "^4.0.0", | ||
"@smithy/querystring-builder": "^3.0.0", | ||
"@smithy/types": "^3.0.0", | ||
"@smithy/util-base64": "^3.0.0", | ||
"tslib": "^2.6.2" | ||
}, | ||
"devDependencies": { | ||
"@smithy/abort-controller": "^2.2.0", | ||
"@tsconfig/recommended": "1.0.1", | ||
"@types/chai-as-promised": "^7.1.2", | ||
"chai": "^4.2.0", | ||
"chai-as-promised": "^7.1.1", | ||
"@smithy/abort-controller": "^3.0.0", | ||
"concurrently": "7.0.0", | ||
"downlevel-dts": "0.10.1", | ||
"karma": "6.4.0", | ||
"karma-chai": "0.1.0", | ||
"karma-chrome-launcher": "3.1.1", | ||
"karma-coverage": "2.2.1", | ||
"karma-env-preprocessor": "0.1.1", | ||
"karma-firefox-launcher": "2.1.3", | ||
"karma-jasmine": "5.1.0", | ||
"karma-mocha": "2.0.1", | ||
"karma-sourcemap-loader": "0.3.8", | ||
"karma-typescript": "5.5.3", | ||
"karma-webpack": "5.0.0", | ||
"rimraf": "3.0.2", | ||
"typedoc": "0.23.23", | ||
"webpack": "5.76.0", | ||
"webpack-cli": "4.10.0" | ||
"typedoc": "0.23.23" | ||
}, | ||
@@ -59,0 +42,0 @@ "typesVersions": { |
@@ -5,1 +5,8 @@ # @smithy/fetch-http-handler | ||
[![NPM downloads](https://img.shields.io/npm/dm/@smithy/fetch-http-handler.svg)](https://www.npmjs.com/package/@smithy/fetch-http-handler) | ||
This is the default `requestHandler` used for browser applications. | ||
Since Node.js introduced experimental Web Streams API in v16.5.0 and made it stable in v21.0.0, | ||
you can consider using `fetch-http-handler` in Node.js, although it's not recommended. | ||
For the Node.js default `requestHandler` implementation, see instead | ||
[`@smithy/node-http-handler`](https://www.npmjs.com/package/@smithy/node-http-handler). |
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
31648
5
468
12
+ Added@smithy/is-array-buffer@3.0.0(transitive)
+ Added@smithy/protocol-http@4.1.5(transitive)
+ Added@smithy/querystring-builder@3.0.8(transitive)
+ Added@smithy/types@3.6.0(transitive)
+ Added@smithy/util-base64@3.0.0(transitive)
+ Added@smithy/util-buffer-from@3.0.0(transitive)
+ Added@smithy/util-uri-escape@3.0.0(transitive)
+ Added@smithy/util-utf8@3.0.0(transitive)
- Removed@smithy/is-array-buffer@2.2.0(transitive)
- Removed@smithy/protocol-http@3.3.0(transitive)
- Removed@smithy/querystring-builder@2.2.0(transitive)
- Removed@smithy/types@2.12.0(transitive)
- Removed@smithy/util-base64@2.3.0(transitive)
- Removed@smithy/util-buffer-from@2.2.0(transitive)
- Removed@smithy/util-uri-escape@2.2.0(transitive)
- Removed@smithy/util-utf8@2.3.0(transitive)
Updated@smithy/protocol-http@^4.0.0
Updated@smithy/types@^3.0.0
Updated@smithy/util-base64@^3.0.0