Socket
Socket
Sign inDemoInstall

hash-stream-validation

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hash-stream-validation

Hash a stream of data, then validate


Version published
Maintainers
1
Created

What is hash-stream-validation?

The hash-stream-validation npm package is used to validate the integrity of data streams by computing and comparing hash values. It is particularly useful for ensuring data integrity during transmission or storage.

What are hash-stream-validation's main functionalities?

Hash Validation

This feature allows you to validate the hash of a data stream against an expected hash value. In this example, a file stream is created and its hash is validated using the SHA-256 algorithm.

const hashStreamValidation = require('hash-stream-validation');
const fs = require('fs');

const fileStream = fs.createReadStream('path/to/file');
const expectedHash = 'expectedHashValue';

hashStreamValidation.validateStream(fileStream, expectedHash, 'sha256')
  .then(() => console.log('Hash is valid'))
  .catch(err => console.error('Hash validation failed', err));

Generate Hash

This feature allows you to generate a hash for a given data stream. In this example, a file stream is created and its hash is generated using the SHA-256 algorithm.

const hashStreamValidation = require('hash-stream-validation');
const fs = require('fs');

const fileStream = fs.createReadStream('path/to/file');

hashStreamValidation.generateHash(fileStream, 'sha256')
  .then(hash => console.log('Generated hash:', hash))
  .catch(err => console.error('Hash generation failed', err));

Other packages similar to hash-stream-validation

Keywords

FAQs

Package last updated on 14 Nov 2015

Did you know?

Socket

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.

Install

Related posts

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