node 压缩解压缩
emer 发布于 2017-9-8 15:03 2237 次阅读
var fs=require("fs"); var zlib=require("zlib"); // fs.createReadStream("1.txt").pipe(zlib.createGzip()).pipe(fs.createWriteStream("1.txt.gz"));//压缩 fs.createReadStream("1.txt.gz").pipe(zlib.createGunzip()).pipe(fs.createWriteStream("1.txt"));//解压 console.log("ok");