【问题标题】:RangeError: Maximum call stack size exceeded while using graphicsmagick (npm gm) in SailsJSRangeError:在 SailsJS 中使用 graphicsmagick (npm gm) 时超出了最大调用堆栈大小
【发布时间】:2021-01-28 19:35:20
【问题描述】:

当我尝试使用 graphicsmagick (npm gm) 在服务器中将 TIFF 文件转换为 JPG 时,我遇到了一个奇怪的问题。当我尝试使用 gm 包的任何方法时,我得到 RangeError: Maximum call stack size exceeded.

getInvoiceImage: function(req, response) {
    var gm = require('gm');
    var id = req.param('doc');
    console.log('----Logging from getInvoiceImage -----');
    console.log('id is :', id);
    gm('/opt/AppName/assets/images/downloads/fileName.tiff').identify( function(err, data) {
        if(err) throw err;
        pageCount = data.Iterations.length;
        console.log('Page count is :', pageCount);
        response.status(200).send({'pageCount':pageCount});
    });
},

当我在服务器中创建一个测试文件并使用伪代码并使用“node test.js”运行时,它可以工作。

var getImage = function() {
    var gm = require('gm');
    gm('/opt/AppName/assets/images/downloads/fileName.tiff').identify( function(err, data) {
        if(err) throw err;
        pageCount = data.Iterations.length;
        console.log('Page count is :', pageCount);
    });
}

getImage();

谁能帮忙?

【问题讨论】:

    标签: javascript node.js sails.js callstack graphicsmagick


    【解决方案1】:

    尝试任何 npm 其他包。替代通用汽车

    【讨论】:

    • 您能否推荐任何更好的软件包来将包含多页的 TIFF 文件转换为 JPG?
    猜你喜欢
    • 2018-05-29
    • 2020-11-19
    • 2015-03-15
    • 1970-01-01
    • 2018-02-06
    • 1970-01-01
    • 2021-07-24
    相关资源
    最近更新 更多