hash-files-cmd
A wrapper around hash-files.
- designed to be used for scripting in the windows shell (cmd)
- compares the calculated hash with a stored hash
- exits with a non-zero exit code if the hashes are not equal
Installation
npm install hash-files
Usage
./bin/hash-files-cmd --files package.json --hash-file .package.json.hash
Specify one or more globs to create the hash for: --files fileOrGlob1, [fileOrGlob2, ...]
Define a filename for the hash: --hash-file fileName
Approach
- calculates the hash for the given
--files
(file(s)/glob(s)() - tries to read the old hash from the given
--hash-file
- stores the calculated hash in the given hash-file
- exits with an error code of -1 if
- hash-file did not exist before
- the old hash differs from the current hash
- exits without an error if the hashes are equal
Limitations
Commandline parameters for hash-files
are not exposed.
Feel free to make a PR.