node·创建压缩解压文件zip格式请求

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'));
637 Views
分享你的喜爱
linwute
linwute

我要像梦一样自由,像大地一样宽容;
在艰辛放逐的路上,点亮生命的光芒;
我要像梦一样自由,像天空一样坚强;
在曲折蜿蜒的路上,体验生命的意义;

留下评论

您的电子邮箱地址不会被公开。 必填项已用*标注