Skip to content

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

License

Notifications You must be signed in to change notification settings

Leelow/sha512sum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sha512sum

npm version Build Status Build Status Coverage 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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published