Node.js pipe中压缩

"use strict";

const fs = require('fs');
const glib = require('zlib');

var fileReadStream = fs.createReadStream('data.json');
var fileWriteStream = fs.createWriteStream('data-1.json.gz');

fileReadStream
  .pipe(glib.reateGzip)
  .pipe(fileWriteStream);

你可能感兴趣的:(Node.js pipe中压缩)