1.1.1 • Published 8 years ago

hash-then v1.1.1

Weekly downloads
172
License
ISC
Repository
github
Last release
8 years ago

hash-then CircleCI Build status

Hash files and directories

How does it work?

  • Given a non-existent path it will return null
  • Given a file path it will return sha256 of the file
  • Given a path to a directory, it will create a temporary tar of the directory with harcoded values for mtime, mode, gid and uid and return the sha256 for that tar
    • If given an output directory (hash(dir, output_dir)) it will save the tar generated in the output_dir

Install

npm install --save hash-then

Use

As a library

  var hash = require('hash-then')
  hash('/path/to/dir').then(function(hash) {
    console.log(hash)
  })

From CLI

$ npm install -g hash-then
$ hash-then test/fixtures/my-file.txt 
> test/fixtures/my-file.txt   8b4781a921e9f1a1cb5aa3063ca8592cac3ee39276d8e8212b336b6e73999798