• +91 9723535972
  • info@interviewmaterial.com

NodeJS Interview Questions and Answers

Question - What is the difference between spawn and fork methods in Node.js?

Answer - The spawn() function is used to create a new process and launch it using the command line. What it does is that it creates a node module on the processor. Node.js invokes this method when the child processes return data. The following is the syntax for the spawn() method: child_process.spawn(command[, args][, options]) Coming to the fork() method, it can be considered as an instance of the already existing spawn() method. Spawning ensures that there are more than one active worker node to handle tasks at any given point of time. The following is the syntax for the fork() method: child_process.fork(modulePath[, args][, options])

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners