Skip to content

Hash transform that creates a has of input stream and is able to be piped to another stream input

License

Notifications You must be signed in to change notification settings

weagle08/hash-transform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hash-transform

Hash transform that creates a hash (checksum) from an input stream leaving stream unchanged and is then able to be piped to input of another stream.

hash-transform is written in ecma6 so I would recommend running nodejs v4.0 or greater (no harmony flag needed)

installation

$ npm install hash-transform

##test

$ npm test

usage

###constructor

new HashTransform(algorithm[, encoding]);

###hashing file stream

var HashTransform = require('hash-transform');
var path = require('path');
var fs = require('fs');

var file = path.resolve('./test/data/test.txt');
var alg = 'sha256';

var hash = new HashTransform(alg);
var fi = fs.createReadStream(file);

fi.pipe(hash).pipe(process.stdout);

hash.on('end', function(){
	console.log(hash.hash);	
});

license

MIT

About

Hash transform that creates a has of input stream and is able to be piped to another stream input

Resources

License

Stars

Watchers

Forks

Packages

No packages published