如何从Node.js内部执行外部程序? [英] How to execute an external program from within Node.js?
本文介绍了如何从Node.js内部执行外部程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从node.js内部执行外部程序?是否有等效于Python的os.system()
或任何添加了此功能的库?
Is it possible to execute an external program from within node.js? Is there an equivalent to Python's os.system()
or any library that adds this functionality?
推荐答案
var exec = require('child_process').exec;
exec('pwd', function callback(error, stdout, stderr){
// result
});
这篇关于如何从Node.js内部执行外部程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文