hash-dir-contents

v0.0.2
A simple function for computing the hash of the contents of an entire directory
glob hash sha1 md5 directory contents recursive version versioning and 1 more...

hash-dir-contents

A simple function for computing the hash of the contents of an entire directory.

Build Status Coverage Status NPM version Dependency Status

NPM

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

npm i hash-dir-contents

Metadata

  • MIT
  • >=0.10.0
  • Unknown
  • released 1/31/2014

Downloads

Maintainers