使用nodejs压缩文件
const fs = require('fs');
const zlib = require('zlib');
const gzip = zlib.createGzip();
const srcFile = './yarn.lock'; // 要压缩的文件
const distFile = 'yarn.lock.gz'; // 压缩后的文件名
const writeStream = fs.createWriteStream(distFile);
fs.createReadStream(srcFile).pipe(gzip).pipe(writeStream);