免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2015年7月8日 星期三

nodejs fork, spawn, exec


http://www.hacksparrow.com/difference-between-spawn-and-exec-of-node-js-child_process.html

Difference between spawn and exec of Node.js child_process
"""...
The most significant difference between child_process.spawn and child_process.exec is
in what they return -
spawn returns a stream and
exec returns a buffer.

... child_process.spawn is "asynchronously asynchronous",
meaning it starts sending back data ... as soon as the child process starts executing


...
child_process.exec returns the whole buffer output from the child process.
By default the buffer size is set at 200k.

If the child process returns anything more than that, your program will
crash with the error message "Error: maxBuffer exceeded".

... child_process.exec is "synchronously asynchronous", ...
it waits for the child process to end and tries to return all the buffered data at once



..."""

沒有留言:

張貼留言