1.0.9 • Published 7 years ago

sha512sum v1.0.9

Weekly downloads
9
License
MIT
Repository
github
Last release
7 years ago

sha512sum

npm version NPM downloads Build Status Build Status Codacy Coverage Codacy Grade JavaScript Style Guide

The same behaviour as linux command with directories support. https://linux.die.net/man/1/sha512sum

Works on Linux and Windows.

Install

$ npm install --save sha512sum

Usage

For a file

const sha512sum = require('sha512sum');

// 992 ... 80a  /path/to/file
sha512sum.fromFile('/path/to/file', options, function(err, hash) {
  if (err) throw err
  console.log(hash)
});

console.log(sha512sum.fromFileSync('/path/to/file', options))

Similar to linux command:

$ sha512sum /path/to/file

For a directory

const sha512sum = require('sha512sum');

// 992 ... 80a  /path/to/dir/h.txt
// erf ... e3f  /path/to/dir/b/e.doc
// cd5 ... r9g  /path/to/dir/b/l.png
// b2r ... v2f  /path/to/dir/c/l.csv
// adr ... 9t6  /path/to/dir/d/o.world
sha512sum.fromDirectory('/path/to/dir', options, function(err, hash) {
  if (err) throw err
  console.log(hash)
});

console.log(sha512sum.fromDirectorySync('/path/to/dir', options))

Similar to linux command:

$ find files -type f -printf "%d%p\n" | sort -n | cut -c 2- | xargs sha512sum

Options

  • cwd: current work directory
  • sep: separator between hash and filename, default value is double-space

License

MIT © Léo Lozach

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago