Created
July 16, 2010 18:34
-
-
Save beanieboi/478729 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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