npm module to hash the contents of files matched by globs
Via Command line
npm install -g glob-hash
-i/--include is mandatory
Usage: glob-hash [options] Options: -h, --help output usage information -V, --version output the version number -i, --include <glob> Files to include. Mandatory. May be used multiple times. -e, --exclude [glob] Files to exclude. May be used multiple times. -a, --algorithm [string] The hashing algorithm to use. Defaults to "sha256". -f, --files Show matched files and exit. -j, --jail [path] A jail path. Reading outside the jail path will throw an error. -n, --filenames Include filenames in the hash.
npm install glob-hash --save
var globHash = ;;
Array include - An array of globs used to match the files to hash. Mandatory option.
Array exclude - An array of globs to exclude from the search.
String algorithm - The hashing algorithms to use. Defaults to "sha256", see crypto.getHashes.
Boolean files - Returns an array of files matched by the globs, instead of returning the hash.
String jail - A jail path. Reading outside the jail path will throw an error. Defaults to never throwing.
Boolean filenames - Include filename in the file hash. If used in combination with jail path, filename includes relative path from jail, otherwise it includes full path.
// Get hash;
// Get list of matched files;