We can using gzip and crypto with stream:

const fs = require('fs')
const zlib = require('zlib')
const file = process.argv[2];
const crypto = require('crypto');
const {Transform} = require('stream'); const progress = new Transform({
transform(chunk, encoding, callback) {
process.stdout.write('.')
callback(null, chunk)
}
}); //crypto + gzip
fs.createReadStream(file)
.pipe(zlib.createGzip())
.pipe(crypto.createCipher('aes192', 'a_secret'))
.pipe(progress)
//.on('data', () => process.stdout.write('.')) // loading / processing
.pipe(fs.createWriteStream(file + '.zz'))
.on('finish', () => console.log('DONE'));

Also unzip it:

// uncrypto + unzip
fs.createReadStream(file)
.pipe(crypto.createCipher('aes192', 'a_secret'))
.pipe(zlib.createGunzip())
.pipe(progress)
.pipe(fs.createWriteStream(file.slice(0, -3)))
.on('finish', () => console.log('DONE'))
05-11 15:38