【发布时间】:2017-12-08 11:33:20
【问题描述】:
我想通过云功能使用 imagemagick 获取上传到 Firebase 存储的图像的高度和宽度。
我写了以下代码:
var child = spawn('identify', ["-ping","-format","`%w %h`",tempLocalFile]);
child.stdout.on('data', function(data) {
console.log('stdout: ' + data);
//Here is where the output goes
});
child.stderr.on('data', function(data) {
console.log('stderr: ' + data);
//Here is where the error output goes
});
但 firebase 日志显示错误:
Cannot read property 'on' of undefined
at mkdirp.then.then (/user_code/index.js
请建议如何编写 Imagemagick 并获取执行的输出。
【问题讨论】:
-
您的错误显示“mkdirp”有问题,但我在您显示的代码中的任何地方都看不到。您确定问题不在未显示的代码中的其他地方吗?
标签: node.js firebase firebase-storage google-cloud-functions