Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/floatdrop/hashdir
Hashes content in directory and returning object with file structure and hashes (useful in tests)
https://github.com/floatdrop/hashdir
Last synced: about 1 month ago
JSON representation
Hashes content in directory and returning object with file structure and hashes (useful in tests)
- Host: GitHub
- URL: https://github.com/floatdrop/hashdir
- Owner: floatdrop
- License: mit
- Created: 2014-01-17T04:40:31.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-17T05:54:49.000Z (about 11 years ago)
- Last Synced: 2024-10-26T21:11:34.436Z (3 months ago)
- Size: 152 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hashdir
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status](https://coveralls.io/repos/floatdrop/hashdir/badge.png)](https://coveralls.io/r/floatdrop/hashdir) [![Dependency Status][depstat-image]][depstat-url]Hashes content in directory and returning object with file structure and hashes (useful in tests)
## Install
Install with npm:
`npm install --save hashdir`
## Example
```js
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`](https://npmjs.org/package/walk) module.
__cb__
`Function`, that recieves `error` as first argument and `result` object in second.
## License
MIT © Vsevolod Strukchinsky
[npm-url]: https://npmjs.org/package/hashdir
[npm-image]: https://badge.fury.io/js/hashdir.png[travis-url]: http://travis-ci.org/floatdrop/hashdir
[travis-image]: https://travis-ci.org/floatdrop/hashdir.png?branch=master[depstat-url]: https://david-dm.org/floatdrop/hashdir
[depstat-image]: https://david-dm.org/floatdrop/hashdir.png?theme=shields.io