New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/body-checksum-node

Package Overview
Dependencies
Maintainers
5
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/body-checksum-node - npm Package Compare versions

Comparing version 3.489.0 to 3.495.0

85

dist-cjs/index.js

@@ -1,33 +0,58 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bodyChecksumGenerator = void 0;
const chunked_stream_reader_node_1 = require("@aws-sdk/chunked-stream-reader-node");
const sha256_tree_hash_1 = require("@aws-sdk/sha256-tree-hash");
const is_array_buffer_1 = require("@smithy/is-array-buffer");
const util_hex_encoding_1 = require("@smithy/util-hex-encoding");
const util_utf8_1 = require("@smithy/util-utf8");
const fs_1 = require("fs");
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
bodyChecksumGenerator: () => bodyChecksumGenerator
});
module.exports = __toCommonJS(src_exports);
var import_chunked_stream_reader_node = require("@aws-sdk/chunked-stream-reader-node");
var import_sha256_tree_hash = require("@aws-sdk/sha256-tree-hash");
var import_is_array_buffer = require("@smithy/is-array-buffer");
var import_util_hex_encoding = require("@smithy/util-hex-encoding");
var import_util_utf8 = require("@smithy/util-utf8");
var import_fs = require("fs");
async function bodyChecksumGenerator(request, options) {
const contentHash = new options.sha256();
const treeHash = new sha256_tree_hash_1.TreeHash(options.sha256, options.utf8Decoder);
const { body } = request;
if (typeof body === "string" || ArrayBuffer.isView(body) || (0, is_array_buffer_1.isArrayBuffer)(body)) {
contentHash === null || contentHash === void 0 ? void 0 : contentHash.update((0, util_utf8_1.toUint8Array)(body));
treeHash === null || treeHash === void 0 ? void 0 : treeHash.update((0, util_utf8_1.toUint8Array)(body));
const contentHash = new options.sha256();
const treeHash = new import_sha256_tree_hash.TreeHash(options.sha256, options.utf8Decoder);
const { body } = request;
if (typeof body === "string" || ArrayBuffer.isView(body) || (0, import_is_array_buffer.isArrayBuffer)(body)) {
contentHash == null ? void 0 : contentHash.update((0, import_util_utf8.toUint8Array)(body));
treeHash == null ? void 0 : treeHash.update((0, import_util_utf8.toUint8Array)(body));
} else {
if (typeof body.path !== "string") {
throw new Error("Unable to calculate checksums for non-file streams.");
}
else {
if (typeof body.path !== "string") {
throw new Error("Unable to calculate checksums for non-file streams.");
}
const bodyTee = (0, fs_1.createReadStream)(body.path, {
start: body.start,
end: body.end,
});
await (0, chunked_stream_reader_node_1.streamReader)(bodyTee, (chunk) => {
contentHash === null || contentHash === void 0 ? void 0 : contentHash.update((0, util_utf8_1.toUint8Array)(chunk));
treeHash === null || treeHash === void 0 ? void 0 : treeHash.update((0, util_utf8_1.toUint8Array)(chunk));
});
}
return [(0, util_hex_encoding_1.toHex)(await contentHash.digest()), (0, util_hex_encoding_1.toHex)(await treeHash.digest())];
const bodyTee = (0, import_fs.createReadStream)(body.path, {
start: body.start,
end: body.end
});
await (0, import_chunked_stream_reader_node.streamReader)(bodyTee, (chunk) => {
contentHash == null ? void 0 : contentHash.update((0, import_util_utf8.toUint8Array)(chunk));
treeHash == null ? void 0 : treeHash.update((0, import_util_utf8.toUint8Array)(chunk));
});
}
return [(0, import_util_hex_encoding.toHex)(await contentHash.digest()), (0, import_util_hex_encoding.toHex)(await treeHash.digest())];
}
exports.bodyChecksumGenerator = bodyChecksumGenerator;
__name(bodyChecksumGenerator, "bodyChecksumGenerator");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
bodyChecksumGenerator
});
{
"name": "@aws-sdk/body-checksum-node",
"version": "3.489.0",
"version": "3.495.0",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:cjs": "node ../../scripts/compilation/inline body-checksum-node",
"build:es": "tsc -p tsconfig.es.json",

@@ -23,10 +23,10 @@ "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",

"dependencies": {
"@aws-sdk/chunked-stream-reader-node": "3.465.0",
"@aws-sdk/sha256-tree-hash": "3.489.0",
"@aws-sdk/types": "3.489.0",
"@smithy/is-array-buffer": "^2.0.0",
"@smithy/protocol-http": "^3.0.12",
"@smithy/types": "^2.8.0",
"@smithy/util-hex-encoding": "^2.0.0",
"@smithy/util-utf8": "^2.0.2",
"@aws-sdk/chunked-stream-reader-node": "3.495.0",
"@aws-sdk/sha256-tree-hash": "3.495.0",
"@aws-sdk/types": "3.495.0",
"@smithy/is-array-buffer": "^2.1.0",
"@smithy/protocol-http": "^3.1.0",
"@smithy/types": "^2.9.0",
"@smithy/util-hex-encoding": "^2.1.0",
"@smithy/util-utf8": "^2.1.0",
"tslib": "^2.5.0"

@@ -33,0 +33,0 @@ },

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