hardware-concurrency
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

hardware-concurrency

Utilities for the number of logical cores.

Install

npm install --save hardware-concurrency
# or
yarn add hardware-concurrency

API

maxCores

function maxCores(): number

Take the number of cores.

Equivalent to navigator.hardwareConcurrency or os.cpus().length.

halfCores

function halfCores(): number

Take half the number of cores and round up.

doubleCores

function doubleCores(): number

Take double the number of cores.

minus1Cores

function minus1Cores(): number

Equivalent to Math.max(maxCores() - 1, 1).

minusCores

function minusCores(num: number): number

Equivalent to Math.max(maxCores() - num, 1).

/hardware-concurrency/

    Package Sidebar

    Install

    npm i hardware-concurrency

    Weekly Downloads

    21

    Version

    0.1.4

    License

    MIT

    Unpacked Size

    13 kB

    Total Files

    31

    Last publish

    Collaborators

    • black_glory