相关疑难解决方法(0)

在node.js中压缩zip存档

我想创建一个zip存档并在node.js中解压缩它.我找不到任何节点实现.请帮忙.

zip node.js

45
推荐指数
5
解决办法
5万
查看次数

我可以通过 Firebase Cloud Functions 压缩 Firebase 存储中的文件吗?

是否可以使用 Cloud Functions 压缩 Firebase 存储中的多个文件?

例如,用户上传了 5 张图片,Firebase Cloud Functions 将为这 5 张图片创建一个 zip 文件

node.js firebase google-cloud-functions firebase-storage

6
推荐指数
1
解决办法
2977
查看次数

为什么在使用archiver.file模块压缩文件时会出现“队列关闭错误”

我正在尝试使用归档程序在 nodejs 中以 zip 格式下载多个文件。这是我的代码:

exports.downloadAllFiles = function(req,res){
    var archive = archiver('zip', {
        gzip: true,
        zlib: { level: 9 } // Sets the compression level.
    });
    var output = fs.createWriteStream( "/home/files/Downloads/demo.zip");

    archive.pipe(output);

    demoDb.findOne({ caseguid: req.params.id }, function(err, data) { 
        if (err) {
            res.json(HttpStatus.INTERNAL_SERVER_ERROR, {});
        } else {
            if(data){
                data.Files.forEach(function(singleDoc){
                       archive.append(fs.createReadStream(singleDoc.filePath), { name: singleDoc.fileName })

                })

            }

         }

    })
    archive.finalize();
};
Run Code Online (Sandbox Code Playgroud)

这是错误堆栈:

{ Error: queue closed
    at Archiver.append (/home/node_modules/archiver/lib/core.js:552:24)
    at Promise.<anonymous> (/home/server/controllers/caseController.js:1722:25)
    at Promise.<anonymous> (/home/node_modules/mpromise/lib/promise.js:177:8)
    at emitOne (events.js:96:13)
    at Promise.emit (events.js:188:7) …
Run Code Online (Sandbox Code Playgroud)

node.js

1
推荐指数
1
解决办法
1780
查看次数