hardware-concurrency
v0.1.4
Published
Utilities for the number of logical cores.
Downloads
246
Maintainers
Readme
hardware-concurrency
Utilities for the number of logical cores.
Install
npm install --save hardware-concurrency
# or
yarn add hardware-concurrencyAPI
maxCores
function maxCores(): numberTake the number of cores.
Equivalent to navigator.hardwareConcurrency or os.cpus().length.
halfCores
function halfCores(): numberTake half the number of cores and round up.
doubleCores
function doubleCores(): numberTake double the number of cores.
minus1Cores
function minus1Cores(): numberEquivalent to Math.max(maxCores() - 1, 1).
minusCores
function minusCores(num: number): numberEquivalent to Math.max(maxCores() - num, 1).
