Node.js GraphicsMagic:检查安装和function

我正在使用GraphicsMagic ( Link )的Node.js模块gm ( Github )。

如何确定gm模块所需的GraphicsMagic软件是否在当前node.js机器上安装且function完整 ? (我想检查一下我的服务器的初始化过程)

您可以调用命令行工具并检查输出。

 var exec = require('child_process').exec; exec("gm", function (error, stdout, stderr) { // Validate the output with one of the parameters. });