Last active
February 7, 2019 20:31
-
-
Save iturgeon/b44e2af7fa1fca64f023d223ad0413fe to your computer and use it in GitHub Desktop.
Node cli script to create checksums of a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// output a file checksum using crypto | |
// Ex call: ./checksum.js md5 package.json | |
const hash = require('crypto').createHash(process.argv[2]).setEncoding('hex') | |
require('fs').createReadStream(process.argv[3]).pipe(hash.on('finish',() => {console.log(hash.read())})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment