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

@aws-sdk/body-checksum-node

Package Overview
Dependencies
Maintainers
5
Versions
163
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.178.0 to 3.183.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
**Note:** Version bump only for package @aws-sdk/body-checksum-node
# [3.178.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.177.0...v3.178.0) (2022-09-23)

@@ -8,0 +16,0 @@

60

dist-es/index.js

@@ -1,2 +0,1 @@

import { __awaiter, __generator } from "tslib";
import { streamReader } from "@aws-sdk/chunked-stream-reader-node";

@@ -7,41 +6,24 @@ import { isArrayBuffer } from "@aws-sdk/is-array-buffer";

import { createReadStream } from "fs";
export function bodyChecksumGenerator(request, options) {
return __awaiter(this, void 0, void 0, function () {
var contentHash, treeHash, body, bodyTee, _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
contentHash = new options.sha256();
treeHash = new TreeHash(options.sha256, options.utf8Decoder);
body = request.body;
if (!(typeof body === "string" || ArrayBuffer.isView(body) || isArrayBuffer(body))) return [3, 1];
contentHash === null || contentHash === void 0 ? void 0 : contentHash.update(body);
treeHash === null || treeHash === void 0 ? void 0 : treeHash.update(body);
return [3, 3];
case 1:
if (typeof body.path !== "string") {
throw new Error("Unable to calculate checksums for non-file streams.");
}
bodyTee = createReadStream(body.path, {
start: body.start,
end: body.end,
});
return [4, streamReader(bodyTee, function (chunk) {
contentHash === null || contentHash === void 0 ? void 0 : contentHash.update(chunk);
treeHash === null || treeHash === void 0 ? void 0 : treeHash.update(chunk);
})];
case 2:
_d.sent();
_d.label = 3;
case 3:
_a = toHex;
return [4, contentHash.digest()];
case 4:
_b = [_a.apply(void 0, [_d.sent()])];
_c = toHex;
return [4, treeHash.digest()];
case 5: return [2, _b.concat([_c.apply(void 0, [_d.sent()])])];
}
export async function bodyChecksumGenerator(request, options) {
const contentHash = new options.sha256();
const treeHash = new TreeHash(options.sha256, options.utf8Decoder);
const { body } = request;
if (typeof body === "string" || ArrayBuffer.isView(body) || isArrayBuffer(body)) {
contentHash?.update(body);
treeHash?.update(body);
}
else {
if (typeof body.path !== "string") {
throw new Error("Unable to calculate checksums for non-file streams.");
}
const bodyTee = createReadStream(body.path, {
start: body.start,
end: body.end,
});
});
await streamReader(bodyTee, (chunk) => {
contentHash?.update(chunk);
treeHash?.update(chunk);
});
}
return [toHex(await contentHash.digest()), toHex(await treeHash.digest())];
}
{
"name": "@aws-sdk/body-checksum-node",
"version": "3.178.0",
"version": "3.183.0",
"scripts": {

@@ -23,8 +23,8 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",

"dependencies": {
"@aws-sdk/chunked-stream-reader-node": "3.170.0",
"@aws-sdk/is-array-buffer": "3.170.0",
"@aws-sdk/protocol-http": "3.178.0",
"@aws-sdk/sha256-tree-hash": "3.178.0",
"@aws-sdk/types": "3.178.0",
"@aws-sdk/util-hex-encoding": "3.170.0",
"@aws-sdk/chunked-stream-reader-node": "3.183.0",
"@aws-sdk/is-array-buffer": "3.183.0",
"@aws-sdk/protocol-http": "3.183.0",
"@aws-sdk/sha256-tree-hash": "3.183.0",
"@aws-sdk/types": "3.183.0",
"@aws-sdk/util-hex-encoding": "3.183.0",
"tslib": "^2.3.1"

@@ -34,3 +34,3 @@ },

"@aws-crypto/sha256-js": "2.0.0",
"@aws-sdk/util-utf8-node": "3.170.0",
"@aws-sdk/util-utf8-node": "3.183.0",
"@tsconfig/recommended": "1.0.1",

@@ -37,0 +37,0 @@ "concurrently": "7.0.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