InterviewSolution
| 1. |
What is spawn in Node JS? |
|
Answer» The spawn is a method in NodeJS that spawns an external application through a new process and finally RETURNS a streaming interface for I/O. It is EXCELLENT for handling applications that produce a large amount of data or for working with streams of data as it reads in. ExampleHere’s an example how CHILD process have the ability to USE the spawn method: const { spawn } = require('child_process'); ls.stdout.on('data', (data) => { ls.stderr.on('data', (data) => { ls.on('close', (code) => { |
|