小编Pra*_*ash的帖子

Node.js:如何使用Node.js来计算PDF页面的尺寸?

如何使用widthheightpdf页面nodejs

是否可以采用文件类型?

这是我的代码angularjs

$scope.demofun = function () {
    var allowedFormats = ['jpeg', 'jpg', 'png', 'pdf'];
    var unsupportedSizes = false;
    if ($scope.file1[0].size < (5 * 1024 * 1024)) {
        //Here I will check the file size and restrict the file if the size is not satisfy my condition.
        //And I need to allow only A4 size pdf when uploading for that I want to get the dimension of pdf document 
        //but …
Run Code Online (Sandbox Code Playgroud)

javascript pdf-generation node.js angularjs

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

为什么在使用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
查看次数

标签 统计

node.js ×2

angularjs ×1

javascript ×1

pdf-generation ×1