Node.js能否在安装它的服务器上启动脚本?例如像bash脚本或PHP脚本,例如调整图片大小之类的脚本?
如果可以的话,如何实现呢?请指向一个文档页面。
谢谢,
丹
Node.js能否在安装它的服务器上启动脚本?例如像bash脚本或PHP脚本,例如调整图片大小之类的脚本?
如果可以的话,如何实现呢?请指向一个文档页面。
谢谢,
丹
var exec = require('child_process').exec;
child = exec("something", function (error, stdout, stderr) {
sys.print('stdout: ' + stdout);
sys.print('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
更多信息请参阅Node.js文档: http://nodejs.org/api/child_process.html