You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

loadavg-windows

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loadavg-windows

Enables os.loadavg for Windows (and optionally any other OS)

1.1.1
latest
Source
npmnpm
Version published
Weekly downloads
16K
119.73%
Maintainers
1
Weekly downloads
 
Created
Source

About

Use require('loadavg-windows') to enjoy os.loadavg() on Windows OS (or force using custom implementation on any other OS).

Motivation

Currently Node.js on Windows platform do not implements os.loadavg() functionality - it returns [0,0,0]

Important details

  • os.loadavg() returns [A, B, C]
    • A - expect value different than 0 after few seconds.
    • B - expect value different than 0 after first 5 minutes.
    • C - expect value different than 0 after first 15 minutes.
  • Requiring it on other operating systems have NO influence, unless require('loadavg-windows').enableCustomLoadavg() called manually.

Usage

Just one line required to enjoy os.loadavg() on Windows OS:

require('loadavg-windows');

setInterval( () => {
  console.log( os.loadavg() );
}, 3000);

Can be activated on any other OS in case native version not working (on Windows OS it is enabled by default)

const { useCustomLoadavg } = require('loadavg-windows');
useCustomLoadavg();

Installation

Requires Node.js v4.8.7

npm install loadavg-windows

Not important details:

This is pure JavaScript, platform-independent implementation of os.loadavg() that can be used on Windows system (or any other system that for some reasons do not supports loadavg)

It uses only os.cpus() for proper calculations.

Keywords

loadavg

FAQs

Package last updated on 11 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts