hash-stream-simple
v2.0.0
Published
Get a hash of a file or a stream
Downloads
4
Readme
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 filestream
- a readable streamalgorithm
- any defined bycrypto.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)