file-hash-cli
v1.0.0
Published
Calculate file hashes (MD5, SHA1, SHA256, SHA512) from the command line
Maintainers
Readme
file-hash-cli
Fast CLI tool to compute and verify file checksums from the terminal.
Supports MD5, SHA1, SHA256, SHA512 — with glob expansion, recursive directories, base64 output, and JSON output.
Installation
npm install -g file-hash-cliCommands
hash — compute hashes
# SHA256 (default), single file
file-hash-cli hash myfile.zip
# Specific algorithm
file-hash-cli hash myfile.zip --algo md5
# All algorithms at once
file-hash-cli hash myfile.zip --all-algos
# Base64 output instead of hex
file-hash-cli hash myfile.zip --format base64
# Multiple files via glob
file-hash-cli hash "src/**/*.ts"
# Recursive directory
file-hash-cli hash ./my-folder --recursive
# JSON output
file-hash-cli hash myfile.zip --all-algos --jsonverify — check against an expected hash
file-hash-cli verify myfile.zip abc123deadbeef...
file-hash-cli verify myfile.zip abc123deadbeef... --algo md5
file-hash-cli verify myfile.zip LVJUjBj... --format base64
file-hash-cli verify myfile.zip abc123... --jsonExit code 0 = match, 1 = mismatch.
compare — diff two files
file-hash-cli compare file1.zip file2.zip
file-hash-cli compare file1.zip file2.zip --all-algos
file-hash-cli compare file1.zip file2.zip --jsonExit code 0 = identical, 1 = different.
Options (shared across commands)
| Option | Description |
|---|---|
| -a, --algo <alg> | Algorithm: md5 sha1 sha256 sha512 (default: sha256) |
| -A, --all-algos | Run all four algorithms |
| -f, --format <fmt> | Output encoding: hex (default) or base64 |
| -r, --recursive | Recurse into directories (hash command) |
| -j, --json | Machine-readable JSON output |
| -V, --version | Show version |
| -h, --help | Show help |
Features
- Streaming reads — handles arbitrarily large files without loading into memory
- Progress bar on stderr for files > 10 MB
- Glob expansion via
fast-glob - Recursive directory hashing (
--recursive) hexandbase64output formats- JSON output for scripting and pipelines
- Verify exit codes for use in shell scripts
License
MIT
