Neighborly Package Megalodon
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

hash-stream

1.2.0 • Public • Published

Hash Stream

NPM version Build status Test coverage Dependency Status License Downloads

Simple wrapper around crypto.createHash() for files and streams.

Installation

$ npm install hash-stream

API

var getHash = require('hash-stream')

getHash(filename || stream, algorithm, callback)

  • filename - path of the file
  • stream - a readable stream
  • algorithm - any defined by crypto.getHashes()

Returns a hash as a raw Buffer, so if you want a hex:

getHash('image.png', 'sha256', function (err, hash) {
  hash = hash.toString('hex')
})

CLI

You can use nhash to hash a file and get the output instantly. The usage options are simple:

$ nhash --help
Usage: nhash [options] [file]

Options:

  -h, --help              output usage information
  -V, --version           output the version number
  -a, --algorithm <sha1>  the hash alorithm
  -e, --encoding <hex>    the encoding of output

Keywords

install

npm i hash-stream

Downloadsweekly downloads

153

version

1.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability