Created
July 9, 2018 20:44
-
-
Save harrietty/b8e8a20b8ff69f31d26b97aed4654e02 to your computer and use it in GitHub Desktop.
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 directoryFiles = fs.readdirSync('./data'); | |
directoryFiles.forEach(filename => { | |
const fileContents = fs.createReadStream(`./data/${filename}`); | |
const writeStream = fs.createWriteStream(`./data/${filename.slice(0, -3)}`); | |
const unzip = zlib.createGunzip(); | |
fileContents.pipe(unzip).pipe(writeStream); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment