1】node·创建流·压缩文件zip格式
var Fs = require('fs'); //创建文件流请求 var Zlib = require('zlib');//解压缩请求 //createReadStream创建读取流,createGunzip解压缩,createWriteStream存储文件,xxx.txt(文件后缀) Fs.createReadStream('ABC123.txt.zip').pipe(Zlib.createGunzip()).pipe(Fs.createWriteStream('ABC000.txt'));
2】node·创建流·解压zip文件
var Fs = require('fs'); //创建文件流请求 var Zlib = require('zlib');//解压缩请求 //createReadStream创建读取流,createGunzip解压缩,createWriteStream存储文件,xxx.txt(文件后缀) Fs.createReadStream('ABC123.txt.zip').pipe(Zlib.createGunzip()).pipe(Fs.createWriteStream('ABC000.txt'));
1,142 Views