Skip to content

Instantly share code, notes, and snippets.

@mekicha
Created May 28, 2017 10:53
Show Gist options
  • Save mekicha/9760ed52cd93bb2f9aed7fadccf5f74a to your computer and use it in GitHub Desktop.
Save mekicha/9760ed52cd93bb2f9aed7fadccf5f74a to your computer and use it in GitHub Desktop.
Gzip a file. To gzip, pass the filename as an argument.
const fs = require('fs');
const zlib = require('zlib');
const file = process.argv[2];
fs.createReadStream(file)
.pipe(zlib.createGzip())
.pipe(fs.createWriteStream(file + '.gz'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment