jan.kowalski
jan.kowalski

Reputation: 105

How to inspect device system information (like RAM size and actual usage) in nodejs

Is it possible to check actual RAM usage on a device with nodejs?

Upvotes: 1

Views: 388

Answers (1)

Sandeep Patel
Sandeep Patel

Reputation: 5148

For System, you can check this out

https://www.npmjs.com/package/node-os-utils

var osu = require('node-os-utils')
var mem = osu.mem
 
mem.info()
  .then(info => {
    console.log(info)
  })

It will log below information

{ totalMemMb: 16384,
  usedMemMb: 13403.41,
  freeMemMb: 2980.59,
  freeMemPercentage: 18.19 }

Similarly, you can do for CPU and device and can run a custom command as well.

Upvotes: 2

Related Questions