InterviewSolution
Saved Bookmarks
| 1. |
What is the fork in node JS? |
|
Answer» Fork() is used to spawn a NEW Node.js PROCESS. It invokes a specific MODULE with an IPC COMMUNICATION channel, thus enabling the sending of MESSAGES between a parent and child. Exampleconst { fork } = require('child_process'); const forked = fork('child.js'); forked.on('message', (msg) => { forked.send({ hello: 'world' }); |
|