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

@aws-sdk/body-checksum-browser

Package Overview
Dependencies
Maintainers
5
Versions
162
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.0.0-gamma.8 to 1.0.0-rc.1

11

CHANGELOG.md

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

# [1.0.0-rc.1](https://github.com/aws/aws-sdk-js-v3/compare/v1.0.0-gamma.11...v1.0.0-rc.1) (2020-10-19)
### Features
* ready for release candidate ([#1578](https://github.com/aws/aws-sdk-js-v3/issues/1578)) ([519f66c](https://github.com/aws/aws-sdk-js-v3/commit/519f66c6388b91d0bd750a511e6d1af56196835e))
# [1.0.0-gamma.8](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/body-checksum-browser@1.0.0-gamma.7...@aws-sdk/body-checksum-browser@1.0.0-gamma.8) (2020-10-07)

@@ -8,0 +19,0 @@

65

dist/cjs/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bodyChecksumGenerator = void 0;
var tslib_1 = require("tslib");
var chunked_blob_reader_1 = require("@aws-sdk/chunked-blob-reader");
var sha256_tree_hash_1 = require("@aws-sdk/sha256-tree-hash");
var util_hex_encoding_1 = require("@aws-sdk/util-hex-encoding");
var MiB = 1024 * 1024;
function bodyChecksumGenerator(request, options) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var contentHash, treeHash, body, _a, _b, _c;
return tslib_1.__generator(this, function (_d) {
switch (_d.label) {
case 0:
contentHash = new options.sha256();
treeHash = new sha256_tree_hash_1.TreeHash(options.sha256, options.utf8Decoder);
body = request.body;
if (!(typeof body === "string")) return [3 /*break*/, 1];
contentHash.update(body);
treeHash.update(body);
return [3 /*break*/, 4];
case 1:
if (!(Boolean(body) && Object.prototype.toString.call(body) === "[object Blob]")) return [3 /*break*/, 3];
return [4 /*yield*/, chunked_blob_reader_1.blobReader(body, function (chunk) {
treeHash === null || treeHash === void 0 ? void 0 : treeHash.update(chunk);
contentHash === null || contentHash === void 0 ? void 0 : contentHash.update(chunk);
}, MiB)];
case 2:
_d.sent();
return [3 /*break*/, 4];
case 3: throw new Error("Unable to calculate checksums for non-blob streams.");
case 4:
_a = util_hex_encoding_1.toHex;
return [4 /*yield*/, contentHash.digest()];
case 5:
_b = [_a.apply(void 0, [_d.sent()])];
_c = util_hex_encoding_1.toHex;
return [4 /*yield*/, treeHash.digest()];
case 6: return [2 /*return*/, _b.concat([_c.apply(void 0, [_d.sent()])])];
}
});
});
const chunked_blob_reader_1 = require("@aws-sdk/chunked-blob-reader");
const sha256_tree_hash_1 = require("@aws-sdk/sha256-tree-hash");
const util_hex_encoding_1 = require("@aws-sdk/util-hex-encoding");
const MiB = 1024 * 1024;
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") {
contentHash.update(body);
treeHash.update(body);
}
else {
if (Boolean(body) && Object.prototype.toString.call(body) === "[object Blob]") {
await chunked_blob_reader_1.blobReader(body, (chunk) => {
treeHash === null || treeHash === void 0 ? void 0 : treeHash.update(chunk);
contentHash === null || contentHash === void 0 ? void 0 : contentHash.update(chunk);
}, MiB);
}
else {
throw new Error("Unable to calculate checksums for non-blob streams.");
}
}
return [util_hex_encoding_1.toHex(await contentHash.digest()), util_hex_encoding_1.toHex(await treeHash.digest())];
}
exports.bodyChecksumGenerator = bodyChecksumGenerator;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLG9FQUEwRDtBQUMxRCw4REFBcUQ7QUFFckQsZ0VBQW1EO0FBRW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Jsb2JdXCIpIHtcbiAgICAgIGF3YWl0IGJsb2JSZWFkZXIoXG4gICAgICAgIGJvZHksXG4gICAgICAgIChjaHVuazogYW55KSA9PiB7XG4gICAgICAgICAgdHJlZUhhc2g/LnVwZGF0ZShjaHVuayk7XG4gICAgICAgICAgY29udGVudEhhc2g/LnVwZGF0ZShjaHVuayk7XG4gICAgICAgIH0sXG4gICAgICAgIE1pQlxuICAgICAgKTtcbiAgICB9IGVsc2Uge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5hYmxlIHRvIGNhbGN1bGF0ZSBjaGVja3N1bXMgZm9yIG5vbi1ibG9iIHN0cmVhbXMuXCIpO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiBbdG9IZXgoYXdhaXQgY29udGVudEhhc2guZGlnZXN0KCkpLCB0b0hleChhd2FpdCB0cmVlSGFzaC5kaWdlc3QoKSldO1xufVxuIl19
{
"name": "@aws-sdk/body-checksum-browser",
"version": "1.0.0-gamma.8",
"version": "1.0.0-rc.1",
"scripts": {

@@ -21,7 +21,7 @@ "prepublishOnly": "yarn build:cjs && yarn build:es",

"dependencies": {
"@aws-sdk/chunked-blob-reader": "1.0.0-gamma.7",
"@aws-sdk/protocol-http": "1.0.0-gamma.8",
"@aws-sdk/sha256-tree-hash": "1.0.0-gamma.8",
"@aws-sdk/types": "1.0.0-gamma.7",
"@aws-sdk/util-hex-encoding": "1.0.0-gamma.7",
"@aws-sdk/chunked-blob-reader": "1.0.0-rc.1",
"@aws-sdk/protocol-http": "1.0.0-rc.1",
"@aws-sdk/sha256-tree-hash": "1.0.0-rc.1",
"@aws-sdk/types": "1.0.0-rc.1",
"@aws-sdk/util-hex-encoding": "1.0.0-rc.1",
"tslib": "^1.8.0"

@@ -31,3 +31,3 @@ },

"@aws-crypto/sha256-js": "^1.0.0-alpha.0",
"@aws-sdk/util-utf8-browser": "1.0.0-gamma.7",
"@aws-sdk/util-utf8-browser": "1.0.0-rc.1",
"@types/jest": "^26.0.4",

@@ -34,0 +34,0 @@ "jest": "^26.1.0",

{
"compilerOptions": {
"declaration": true,
"strict": true,
"sourceMap": false,
"downlevelIteration": true,
"importHelpers": true,
"noEmitHelpers": true,
"lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"],
"rootDir": "./src",
"outDir": "./dist/cjs",
"inlineSourceMap": true,
"inlineSources": true,
"baseUrl": "."

@@ -15,0 +6,0 @@ },

{
"compilerOptions": {
"declaration": true,
"strict": true,
"sourceMap": false,
"downlevelIteration": true,
"importHelpers": true,
"noEmitHelpers": true,
"lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"],
"rootDir": "./src",
"outDir": "./dist/es",
"inlineSourceMap": true,
"inlineSources": true,
"baseUrl": "."

@@ -15,0 +7,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