Skip to content

Instantly share code, notes, and snippets.

@roninhack
Forked from mekicha/decrypt.js
Created August 17, 2017 03:33
Show Gist options
  • Select an option

  • Save roninhack/cadff7615f3379b3df2927251ed67206 to your computer and use it in GitHub Desktop.

Select an option

Save roninhack/cadff7615f3379b3df2927251ed67206 to your computer and use it in GitHub Desktop.
Compress and encrypt the file. To decrypt, see decrypt.js
fs.createReadStream(file)
.pipe(crypto.createDecipher('aes192', 'a_secret'))
.pipe(zlib.createGunzip())
.pipe(reportProgress)
.pipe(fs.createWriteStream(file.slice(0, -3)))
.on('finish', () => console.log('Done'));
const crypto = require('crypto');
fs.createReadStream(file)
.pipe(zlib.createGzip())
.pipe(crypto.createCipher('aes192', 'a_secret'))
.pipe(reportProgress)
.pipe(fs.createWriteStream(file + '.zz'))
.on('finish', () => console.log('Done'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment