Executing files or commands with Child Processes

Download node.js eBook


  • child_process.exec(command[, options][, callback])
  • child_process.execFile(file[, args][, options][, callback])
  • child_process.fork(modulePath[, args][, options])
  • child_process.spawn(command[, args][, options])
  • child_process.execFileSync(file[, args][, options])
  • child_process.execSync(command[, options])
  • child_process.spawnSync(command[, args][, options])


When dealing with child processes, all of the asynchronous methods will return an instance of ChildProcess, while all the synchronous versions will return the output of whatever was run. Like other synchronous operations in Node.js, if an error occurs, it will throw.

Related Examples


273 Contributors: 1
Friday, August 5, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook