The main differences between spawn() and fork() methods in Node.js are
Spawn Fork Designed to run system commands. A special instance of spawn() that runs a new instance of V8. Does not execute any other code within the node process. Can create multiple workers that run on the same Node codebase. child_process.spawn(command[, args][, options]) creates a new process with the given command. Special case of spawn() to create child processes using. child_process.fork(modulePath[, args][, options]) Creates a streaming interface (data buffering in binary format) between parent and child process. Creates a communication (messaging) channel between parent and child process. More useful for continuous operations like data streaming (read/write), example, streaming images/files from the spawn process to the parent process. More useful for messaging, example, JSON or XML data messaging.

Spawn Fork
Designed to run system commands. A special instance of spawn() that runs a new instance of V8.
Does not execute any other code within the node process. Can create multiple workers that run on the same Node codebase.
child_process.spawn(command[, args][, options]) creates a new process with the given command. Special case of spawn() to create child processes using. child_process.fork(modulePath[, args][, options])
Creates a streaming interface (data buffering in binary format) between parent and child process. Creates a communication (messaging) channel between parent and child process.
More useful for continuous operations like data streaming (read/write), example, streaming images/files from the spawn process to the parent process. More useful for messaging, example, JSON or XML data messaging.

www.TechSearhWeb.com