Node.js FAQ: Top Questions
22. What are child processes in Node.js?
Child processes in Node.js are separate processes spawned by a Node.js application to execute scripts or commands, enabling parallel or external task execution.
-
Methods:
spawn,exec,execFile,fork. - spawn: Streams output, good for long-running processes.
- exec: Buffers output, suitable for short commands.
- Use Case: Running shell commands, CPU-intensive tasks.
