unzip multiple .gz files using nodejs zlib
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
var zlib = require('zlib'); | |
var fs = require('fs'); | |
function decompress(inFilename, outFilename) { | |
var unzip = zlib.createUnzip(); | |
var input = fs.createReadStream(inFilename); | |
var output = fs.createWriteStream(outFilename); | |
input.pipe(unzip).pipe(output); | |
} | |
decompress('assets/models/CLH_Computer.mtl.gz', 'assets/models/CLH_Computer.mtl'); | |
decompress('assets/models/CLH_Computer.obj.gz', 'assets/models/CLH_Computer.obj'); | |
decompress('assets/models/CLH_ep2_computer_high_poly.mtl.gz', 'assets/models/CLH_ep2_computer_high_poly.mtl'); | |
decompress('assets/models/CLH_ep2_computer_high_poly.obj.gz', 'assets/models/CLH_ep2_computer_high_poly.obj'); | |
decompress('assets/models/CLH_ep2_cyc_wall.mtl.gz', 'assets/models/CLH_ep2_cyc_wall.mtl'); | |
decompress('assets/models/CLH_ep2_cyc_wall.obj.gz', 'assets/models/CLH_ep2_cyc_wall.obj'); | |
decompress('assets/models/CLH_Shuttle.mtl.gz', 'assets/models/CLH_Shuttle.mtl'); | |
decompress('assets/models/CLH_Shuttle.obj.gz', 'assets/models/CLH_Shuttle.obj'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment