Node.jsadvanced
child_process to fan work out across CPU cores
import { fork } from "node:child_process";
import { cpus } from "node:os";
import { once } from "node:events";
import { fileURLToPath } from "node:url";
Fork one child process per CPU core, split a CPU-bound range across them, and aggregate results over IPC — using one self-contained file.