hash-dir-contents
v0.0.2
Published
A simple function for computing the hash of the contents of an entire directory
Downloads
4
Readme
hash-dir-contents
A simple function for computing the hash of the contents of an entire directory.
Installation
npm install hash-dir-contents
Usage
This module exports a function that has the following signature:
function([options], callback)
where options
is an object that can contain the following properties:
directory
- (optional) The directory to hash the contents of. Defaults to the current working directory.algorithm
- (optional) The algorithm to use to hash the content, "sha1" or "md5". Defaults to "sha1".
and callback
is a function that will be passed an error object as the first parameter and the hash as the second parameter.
Examples
var hasher = require('hash-dir-contents');
hasher({
directory: '/home/me/stuff',
algorithm: 'md5'
}, function(error, hash) {
console.log(hash); // example: '843d5af0230cb6ddcd767e9d92f7e152'
});