1.0.2 • Published 9 years ago

files-hash v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 years ago

files-hash

Hash a glob of files. Useful for caching and things.

Installation

Install the package with npm.

npm install files-hash

Usage

var hash = require('files-hash');

hash('**/*.txt', { cwd: 'test/example' })
    .then(function(hashes) {
        console.log(hashes);
    });

/**
 * Produces:
 * { 'hello1.txt': '75fdf620d8a1c7e6ea7f4c24ba5ff991fbb82e86',
   'hello2.txt': '38ffd0b05376325c933e89ff8f0c2ccf1de05a01' }
 **/

API

hash(glob, options) : Promise

Returns a Promise which resolves with an object where each key is a path relative to the glob cwd. The SHA1 hash of that file is the value.