解压缩node/express中的嵌套文件

b4qexyjb  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(451)

我正在尝试在node/express中解压一个包含多个.zip文件的.zip文件-有人知道如何轻松地做到这一点吗?我尝试过使用runzip包,但运气不太好。
这是我的密码:

runzip.open("test.zip", { filter: isZip }, function(err, zipfile) {
        zipfile.on("entry", function(entry) {
            entry.openReadStream(function(err, readStream) {
                var outputDir = entry.nestedPath.join("/");
                mkdirp(outputDir);
                readStream.pipe(fs.createWriteStream(outputDir + "/" + entry.fileName));
            });
        });
    });

我发现以下错误:

Error: ENOENT: no such file or directory, open '1-0.zip/dummy.txt'
Emitted 'error' event on WriteStream instance at:
    at WriteStream.onerror (_stream_readable.js:747:14)
    at WriteStream.emit (events.js:321:20)
    at internal/fs/streams.js:397:14
    at FSReqCallback.oncomplete (fs.js:154:23) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '1-0.zip/dummy.txt'
}

谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题