Execute a command line binary with Node.js

后端 未结 12 2495
星月不相逢
星月不相逢 2020-11-22 01:39

I am in the process of porting a CLI library from Ruby over to Node.js. In my code I execute several third party binaries when necessary. I am not sure how best to accomplis

12条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 01:57

    Now you can use shelljs ( from node v4 ) as follows :

    var shell = require('shelljs');
    
    shell.echo('hello world');
    shell.exec('node --version')
    

提交回复
热议问题