我用代码在nodejs中压缩了一个文件夹:
fstream = require('fstream'),
tar = require('tar'),
zlib = require('zlib');
fstream.Reader(toZipDetails) /* Read the source directory */
         .pipe(tar.Pack()) /* Convert the directory to a .tar file */
         .pipe(zlib.Gzip()) /* Compress the .tar file */
         .pipe(fstream.Writer(zipOutDetails)); /* Give the output file name */
然后我解压缩它:
fs.createReadStream(inFileName)
                .pipe(zlib.Gunzip())
                .pipe(tar.Extract({ path: "C:\\temp\\extract" }))
                .on("end", function () {
                    alert("done");
                });
文件夹名称toZip与 file a.txt。
我想要一个文件夹中带有 a.txt 的 toZipextract文件夹,但是
我有一个a.txt file in extract folder。
我怎样才能得到toZip文件夹?