2.0.0 • Published 9 years ago

hash-stream-simple v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

Hash Stream

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

Same as hash-stream without the Promise dependency

Installation

$ npm install hash-stream-simple

API

var getHash = require('hash-stream-simple')

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')
})

License

MIT

Originally authored by Jonathan Ong (@jonathanong)