如何使用width
和height
的pdf
页面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) 我正在尝试使用归档程序在 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)