0.0.6 • Published 3 years ago

@felipebutcher/node-os-info v0.0.6

Weekly downloads
6
License
ISC
Repository
github
Last release
3 years ago

node-os-info

When I needed to get memory, cpu and disk information on NodeJS, I ended up looking for answers on stackoverflow and using multiple packages with some code. I am putting all together here.

The values that this package show are the same as in htop, which were what I was looking for.

Code from others

This project uses this code for CPU calculation.
We also use NodeJS OS module.
The packages systeminformation and check-disk-space are used for memory and disk calculation.

Installation

npm install @felipebutcher/node-os-info

Usage

All the three variables (memory, cpu and disk) are a number between 0 and 1, representing the percentage of use of each resource.

const osInfo = require("@felipebutcher/node-os-info");

osInfo.mem(memory => {
    console.log("Memory: " + Math.round(memory * 100) + "%");
});

osInfo.cpu(cpu => {
    console.log("CPU: " + Math.round(cpu * 100) + "%");
});

osInfo.disk(disk => {
    console.log("Disk: " + Math.round(disk * 100) + "%");
});

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

There's no license, do what you want.

0.0.6

3 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago