June 2014
Intermediate to advanced
696 pages
38h 52m
English
A rather complex method of adding work to another process from a Node.js process is to spawn another process; link the stdio, stdout, and stderr pipes between them; and then execute a file on the new process, using the spawn() function. This method is a bit heavier than simply using exec() but provides some great benefits.
The major difference between spawn() and exec()/execFile() is that stdin for the spawned process can be configured, and stdout and stderr are Readable streams in the parent process. This means exec() and execFile() must complete before you can read the buffer outputs. However, you can read output data from a spawn() process as soon as it has been written.
The syntax ...
Read now
Unlock full access