Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@aws-sdk/hash-stream-node
Advanced tools
[![NPM version](https://img.shields.io/npm/v/@aws-sdk/hash-stream-node/latest.svg)](https://www.npmjs.com/package/@aws-sdk/hash-stream-node) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/hash-stream-node.svg)](https://www.npmjs.com/package/@aws
@aws-sdk/hash-stream-node is a package from the AWS SDK for JavaScript that provides utilities for hashing streams. It is particularly useful for creating hash digests of data streams, which is a common requirement when working with AWS services like S3 for data integrity checks.
Hashing a Stream
This feature allows you to create a hash digest of a data stream using a specified hashing algorithm (e.g., SHA-256). The code sample demonstrates how to read a file as a stream and generate its hash digest.
const { Hash } = require('@aws-sdk/hash-stream-node');
const { createReadStream } = require('fs');
const stream = createReadStream('path/to/file');
const hash = new Hash('sha256');
hash.update(stream);
hash.digest().then(digest => {
console.log('Hash digest:', digest);
});
The 'crypto' module is a built-in Node.js module that provides cryptographic functionality, including hashing. It can be used to hash streams, but it requires more manual setup compared to @aws-sdk/hash-stream-node. For example, you need to manually handle the stream events and update the hash accordingly.
The 'hash-stream' package is a third-party Node.js module that simplifies hashing streams. It provides a more straightforward API for hashing streams compared to the built-in 'crypto' module, but it may not be as tightly integrated with AWS services as @aws-sdk/hash-stream-node.
The 'stream-hash' package is another third-party module for hashing streams. It offers similar functionality to @aws-sdk/hash-stream-node but is more general-purpose and not specifically designed for AWS SDK integration.
A utility for calculating the hash of Node.JS readable streams. This package is currently only compatible with file streams, as no other stream type can be replayed.
An internal package
You probably shouldn't, at least directly.
FAQs
[![NPM version](https://img.shields.io/npm/v/@aws-sdk/hash-stream-node/latest.svg)](https://www.npmjs.com/package/@aws-sdk/hash-stream-node) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/hash-stream-node.svg)](https://www.npmjs.com/package/@aws
The npm package @aws-sdk/hash-stream-node receives a total of 755,976 weekly downloads. As such, @aws-sdk/hash-stream-node popularity was classified as popular.
We found that @aws-sdk/hash-stream-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.