child_process 模块让 Node 可以将其他程序/命令(shell 命令、脚本、其他二进制文件)作为独立的 OS 进程运行。用于调用系统工具、在主进程外运行 CPU 密集型工作或协调其他程序。
四种主要方法
text
exec → run a shell command, buffer all output (simple, small output)
execFile → run a file directly (no shell — safer, faster)
spawn → stream output (for large output / long-running processes)
fork → spawn a new NODE process with an IPC channel (Node-to-Node)
