JSPM

cpu-pct

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q24965F
  • License MIT

Get the current CPU percentage

Package Exports

  • cpu-pct

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cpu-pct) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cpu-pct

Node module to get the current CPU usage in percent. This uses the os module and has no outside dependencies.

This function gets the CPU percentage once and does not continue returning values.

Install

$ npm install --save cpu-pct

Usage

const cpu = require('cpu-pct');

const options = {
  interval: 100, // time span to get average percent usage (in milliseconds)
  returnType: "string", // "fraction", "whole", or "string"
  decimals: 2
};

cpu.cpuPercent(options, function(pct) {
  console.log(pct);
});