Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@smithy/fetch-http-handler

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/fetch-http-handler - npm Package Compare versions

Comparing version 3.2.9 to 4.0.0

29

dist-cjs/index.js

@@ -195,15 +195,8 @@ var __defProp = Object.defineProperty;

// src/stream-collector.ts
var import_util_base64 = require("@smithy/util-base64");
var streamCollector = /* @__PURE__ */ __name((stream) => {
var streamCollector = /* @__PURE__ */ __name(async (stream) => {
if (typeof Blob === "function" && stream instanceof Blob) {
return collectBlob(stream);
return new Uint8Array(await stream.arrayBuffer());
}
return collectStream(stream);
}, "streamCollector");
async function collectBlob(blob) {
const base64 = await readToBase64(blob);
const arrayBuffer = (0, import_util_base64.fromBase64)(base64);
return new Uint8Array(arrayBuffer);
}
__name(collectBlob, "collectBlob");
async function collectStream(stream) {

@@ -231,20 +224,2 @@ const chunks = [];

__name(collectStream, "collectStream");
function readToBase64(blob) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => {
if (reader.readyState !== 2) {
return reject(new Error("Reader aborted too early"));
}
const result = reader.result ?? "";
const commaIndex = result.indexOf(",");
const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
resolve(result.substring(dataOffset));
};
reader.onabort = () => reject(new Error("Read aborted"));
reader.onerror = () => reject(reader.error);
reader.readAsDataURL(blob);
});
}
__name(readToBase64, "readToBase64");
// Annotate the CommonJS export names for ESM import in node:

@@ -251,0 +226,0 @@

@@ -1,13 +0,7 @@

import { fromBase64 } from "@smithy/util-base64";
export const streamCollector = (stream) => {
export const streamCollector = async (stream) => {
if (typeof Blob === "function" && stream instanceof Blob) {
return collectBlob(stream);
return new Uint8Array(await stream.arrayBuffer());
}
return collectStream(stream);
};
async function collectBlob(blob) {
const base64 = await readToBase64(blob);
const arrayBuffer = fromBase64(base64);
return new Uint8Array(arrayBuffer);
}
async function collectStream(stream) {

@@ -34,18 +28,1 @@ const chunks = [];

}
function readToBase64(blob) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => {
if (reader.readyState !== 2) {
return reject(new Error("Reader aborted too early"));
}
const result = (reader.result ?? "");
const commaIndex = result.indexOf(",");
const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
resolve(result.substring(dataOffset));
};
reader.onabort = () => reject(new Error("Read aborted"));
reader.onerror = () => reject(reader.error);
reader.readAsDataURL(blob);
});
}

10

package.json
{
"name": "@smithy/fetch-http-handler",
"version": "3.2.9",
"version": "4.0.0",
"description": "Provides a way to make requests",

@@ -27,5 +27,5 @@ "scripts": {

"dependencies": {
"@smithy/protocol-http": "^4.1.4",
"@smithy/querystring-builder": "^3.0.7",
"@smithy/types": "^3.5.0",
"@smithy/protocol-http": "^4.1.5",
"@smithy/querystring-builder": "^3.0.8",
"@smithy/types": "^3.6.0",
"@smithy/util-base64": "^3.0.0",

@@ -35,3 +35,3 @@ "tslib": "^2.6.2"

"devDependencies": {
"@smithy/abort-controller": "^3.1.5",
"@smithy/abort-controller": "^3.1.6",
"concurrently": "7.0.0",

@@ -38,0 +38,0 @@ "downlevel-dts": "0.10.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc