Created
May 28, 2017 10:53
-
-
Save mekicha/9760ed52cd93bb2f9aed7fadccf5f74a to your computer and use it in GitHub Desktop.
Gzip a file. To gzip, pass the filename as an argument.
This file contains 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
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