Skip to content
Hashes content in directory and returning object with file structure and hashes (useful in tests)
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.editorconfig
.gitignore
.jshintrc
.npmignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

hashdir

NPM version Build Status Coverage Status Dependency Status

Hashes content in directory and returning object with file structure and hashes (useful in tests)

Install

Install with npm:

npm install --save hashdir

Example

var hashdir = require('hashdir');

/* `directory` structure:
directory/
  folder/
    file2.js
  emptyfolder/
  file1.js
*/
hashdir('directory', function (err, result) {
    assert.deepEqual(result, {
        'file1.js': 'SHA-1 of file1.js content',
        'folder/file2.js': 'SHA-1 of file2.js content',
        'folder/emptyfolder': undefined,
        'folder/folder': undefined,
    });
});

API

hashdir(path[, opts], cb)

path

String, path to directory, that you want to be hashed.

opts

Object, that passed to walk module.

cb

Function, that recieves error as first argument and result object in second.

License

MIT © Vsevolod Strukchinsky

Something went wrong with that request. Please try again.