verify-md5 v0.2.1
verify-md5
A standalone program to compare a file of md5 hash signatures in /path/to/md5.json to the md5 hashes of the contents of the listed files in that same directory
Installation
To install globally:
npm i verify-md5 -gPrerequisites
nodejsis installed and accesible by invokingnode- An
md5.jsonfile consisting of an object with filenames as keys and base64 md5 as value for each key.
Example md5.json file:
Usage
If the path begins with gs:// it refers to a Google Cloud Storagetm bucket, e.g. gs://bucketName/path/to/md5.json
verify-md5 --key /path/to/secret/myserviceaccountkey.json gs://bucketName/path/to/md5.jsonIf the path is a filesystem path, the local filesystem is used:
verify-md5 /path/to/md5.json--json enables json output:
json output is a 4 element array:
[true|false, goodFiles, badFiles, failErrors, dirname]
Otherwise, "human-readable" output is used.
Examples
Success example, using storage bucket.
Failure example, with local file system.
Authentication / Authorization
verify-md5 on a filesystem path runs with the permissions of the current user.
verify-md5 on a gs:// path will attempt to authenticate with the Google Storage API.
Unless you run in the Google Cloud, you will need to include a --key keyfilename to access your buckets.
If you need to generate a key for your project, look in the IAM section of the Google Cloud Platform Console and generate either:
- a service account key for role: Storage Object Viewer
- or, for granularity, a new service account with no permissions, added as a reader to an individual bucket acl.
Important: It is solely your responsibility to keep API keys secret and manage related security and financial risks.
Storage API usage
Only the bucket's md5.json file is downloaded with a storage.bucket.file.download call.
Then storage.bucket.file.get calls are used to access md5 metadata for each file, not .download() calls.
Creating the necessary md5 metadata in the bucket is normally automatic when objects are stored.
Creating the md5.json file in the bucket to enable these comparisons is your responsibility.
Help
verify-md5 --helpprints this reminder message
Copyright
Copyright 2017 Paul Brewer, Economic and Financial Technology Consulting LLC drpaulbrewer@eaftc.com
License
The MIT License
Trademarks
Google Cloud Storagetm is a trademark of Google, Inc.
This software is not a product of Google, Inc.