sha512sum
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 = ; // 992 ... 80a /path/to/filesha512sum; console
Similar to linux command:
$ sha512sum /path/to/file
For a directory
const 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.worldsha512sum; console
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