Skip to content

alantrrs/hash-then

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Hash files and directories

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published