OS
os.availableParallelism()
Estimates useful default parallelism as a positive integer. Start from it when sizing a worker pool, then measure workload and memory pressure; it is not a guaranteed CPU quota or throughput estimate. Tested on Node.js 22.16.0. Example output (one line per entry): ["true"].
Formal Syntax & Structure
nodejs syntaxnodejs
os.availableParallelism()Return Value
number
Estimated available parallelism.
Working Example
Example Snippetnodejs
import os from 'node:os';const n = os.availableParallelism();console.log(Number.isInteger(n) && n >= 1);