问题
How can I compress a file/files and save into a .zip
extension file with the provided node.js zlib module? I figured how to save into .gz
using gzip like the following:
const gzip = zlib.createGzip();
const fs = require('fs');
const input = fs.createReadStream('myfile.txt');
const out = fs.createWriteStream('myfile.txt.gz');
input.pipe(gzip).pipe(out);
来源:https://stackoverflow.com/questions/48638885/compress-into-zip-file-with-node-js-core-zlib-module