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

@aws-sdk/hash-stream-node

Package Overview
Dependencies
Maintainers
6
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/hash-stream-node - npm Package Compare versions

Comparing version 3.52.0 to 3.53.0

dist-cjs/fsCreateReadStream.js

12

CHANGELOG.md

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

# [3.53.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.52.0...v3.53.0) (2022-02-24)
### Bug Fixes
* **hash-stream-node:** support file stream in readableStreamHasher ([#3338](https://github.com/aws/aws-sdk-js-v3/issues/3338)) ([1e3faa1](https://github.com/aws/aws-sdk-js-v3/commit/1e3faa1976a5119dcc985c8f513833e3d01fe3dc))
* **hash-stream-node:** throw error if non-file readableStream is flowing ([#3341](https://github.com/aws/aws-sdk-js-v3/issues/3341)) ([76df645](https://github.com/aws/aws-sdk-js-v3/commit/76df645d6109f6ce853830236a0bc77960b97f6c))
# [3.52.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.51.0...v3.52.0) (2022-02-18)

@@ -8,0 +20,0 @@

10

dist-cjs/readableStreamHasher.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readableStreamHasher = void 0;
const fsCreateReadStream_1 = require("./fsCreateReadStream");
const HashCalculator_1 = require("./HashCalculator");
const isFileStream_1 = require("./isFileStream");
const readableStreamHasher = (hashCtor, readableStream) => {
if (!isFileStream_1.isFileStream(readableStream) && readableStream.readableFlowing !== null) {
throw new Error("Unable to calculate hash for flowing readable stream");
}
const streamToPipe = isFileStream_1.isFileStream(readableStream) ? fsCreateReadStream_1.fsCreateReadStream(readableStream) : readableStream;
const hash = new hashCtor();
const hashCalculator = new HashCalculator_1.HashCalculator(hash);
readableStream.pipe(hashCalculator);
streamToPipe.pipe(hashCalculator);
return new Promise((resolve, reject) => {
readableStream.on("error", (err) => {
streamToPipe.on("error", (err) => {
hashCalculator.end();

@@ -12,0 +18,0 @@ reject(err);

@@ -0,8 +1,14 @@

import { fsCreateReadStream } from "./fsCreateReadStream";
import { HashCalculator } from "./HashCalculator";
import { isFileStream } from "./isFileStream";
export var readableStreamHasher = function (hashCtor, readableStream) {
if (!isFileStream(readableStream) && readableStream.readableFlowing !== null) {
throw new Error("Unable to calculate hash for flowing readable stream");
}
var streamToPipe = isFileStream(readableStream) ? fsCreateReadStream(readableStream) : readableStream;
var hash = new hashCtor();
var hashCalculator = new HashCalculator(hash);
readableStream.pipe(hashCalculator);
streamToPipe.pipe(hashCalculator);
return new Promise(function (resolve, reject) {
readableStream.on("error", function (err) {
streamToPipe.on("error", function (err) {
hashCalculator.end();

@@ -9,0 +15,0 @@ reject(err);

4

package.json
{
"name": "@aws-sdk/hash-stream-node",
"version": "3.52.0",
"version": "3.53.0",
"scripts": {

@@ -22,3 +22,3 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",

"dependencies": {
"@aws-sdk/types": "3.52.0",
"@aws-sdk/types": "3.53.0",
"tslib": "^2.3.0"

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