Skip to content

Instantly share code, notes, and snippets.

@iturgeon
Last active February 7, 2019 20:31
Show Gist options
  • Save iturgeon/b44e2af7fa1fca64f023d223ad0413fe to your computer and use it in GitHub Desktop.
Save iturgeon/b44e2af7fa1fca64f023d223ad0413fe to your computer and use it in GitHub Desktop.
Node cli script to create checksums of a file
#!/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