Skip to content

Instantly share code, notes, and snippets.

@beanieboi
Created July 16, 2010 18:34
Show Gist options
  • Save beanieboi/478729 to your computer and use it in GitHub Desktop.
Save beanieboi/478729 to your computer and use it in GitHub Desktop.
var file = fs.createReadStream(path);
var sha1_for_file = crypto.createHash('sha1');
file.addListener('error', function(err) {
throw err;
});
file.addListener('data', function(data) {
sha1_for_file.update(data);
});
file.addListener('close', function() {
return sha1_for_file.digest('hex');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment