Module for Node Js that captures information from the Operating System and the computer

Asked

Viewed 651 times

0

How to get using Node Js the use of processing, memory, load Average and operating system information?

I know that in Java, for example, there is the library "Operatingsystemmxbean" would like an equivalent.

The native module 'the' is a good option?

1 answer

1


with the module you can get the CPU and memory information:

const os = require('os');

console.log(os.cpus());
console.log(os.totalmem());
console.log(os.freemem())

The Module os-utils is also interesting, works more or less the same way:

const os = require('os-utils');

os.cpuUsage(function(v){
    console.log( 'CPU Usage (%): ' + v );
});

Disk usage information you can use the diskspace:

const diskspace = require('diskspace');

diskspace.check('C', function (err, result) {
    console.log(JSON.stringify(result))
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.