Executing an Executable File on Another Process Using execFile()
A simple way to add work to another process from a Node.js process is to execute an executable file on another process using the execFile()
function. This is very similar to exec()
except that there is no subshell used. This makes execFile()
lighter weight, but it also means that the command to execute must be a binary executable. Shell scripts on Linux and batch files on Windows do not work with the execFile()
function.
The syntax for the execFile()
function, which returns a ChildProcess
object, call is shown below:
child_process.execFile(file, args, options, callback)
The file
parameter is a string that specifies the path to the executable file that ...
Get Node.js, MongoDB, and AngularJS Web Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.