estimate-cores

2.0.1 • Public • Published

estimate-cores

Estimate the number of processes that can be executed concurrently. Useful if you want to figure out how many Web Workers you can spin up. Just remember to save a core for the main thread.

Example

const estimateCores = require('estimate-cores');

estimateCores((error, coreCount) => {
  if (error) {
    // handle error
    return;
  }

  console.log(coreCount);
  // => 4
});

Installation

$ npm install estimate-cores

API

const estimateCores = require('estimate-cores');

estimateCores([force=false], callback)

Estimates the number of possible concurrent processes. The core count is cached for future calls. To force a recount, pass true for force.

Readme

Keywords

Package Sidebar

Install

npm i estimate-cores

Weekly Downloads

8

Version

2.0.1

License

MIT

Unpacked Size

6.17 kB

Total Files

4

Last publish

Collaborators

  • kenan