hash-dir-contents
A simple function for computing the hash of the contents of an entire directory.
![Dependency Status](https://david-dm.org/mac-/hash-dir-contents.png)
![NPM](https://nodei.co/npm/hash-dir-contents.png?downloads=true&stars=true)
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'
});
![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/mac-/hash-dir-contents/trend.png)