Node module that provides utilities for interacting with the operating system and the hardware of the machine.
JavaScript:
const osUtils = require('lup-system');
osUtils.getCpuUtilization().then(utilization => console.log("CPU Utilization: " + utilization));
osUtils.getDrives().then(drives => console.log("Drives: " + drives)); // Array of drive objects
osUtils.getNetworkInterfaces().then(interfaces => console.log("Network Interfaces: " + interfaces));
osUtils.getTemperatures().then(temps => console.log("Temperatures: " + temps));
TypeScript:
import osUtils from 'lup-system';
(async () => {
console.log("CPU Utilization: " + await osUtils.getCpuUtilization());
console.log("Drives: ", await osUtils.getDrives()); // Array of drive objects
console.log("Network Interfaces: ", await osUtils.getNetworkInterfaces());
console.log("Temperatures: ", await osUtils.getTemperatures());
})();
Output:
CPU Utilization: 0.2313135420902806
Drives: [
{
filesystem: 'C:',
mount: 'C:',
type: 'ntfs',
total: 1999519543296,
free: 479322533888,
used: 1520197009408,
utilization: 0.7602811457907099
},
{
filesystem: 'D:',
mount: 'D:',
type: 'ntfs',
total: 1000203087872,
free: 917103894528,
used: 83099193344,
utilization: 0.08308232033236287
}
]
Network Interfaces: [
{
name: 'Loopback Pseudo-Interface 1',
addresses: [ [Object], [Object] ],
status: { operational: 'unknown', admin: true, cable: false },
physical: true
},
{
name: 'Ethernet',
addresses: [],
status: { operational: 'up', admin: true, cable: true },
physical: true,
speed: { bits: 1000000000, bytes: 125000000 },
utilization: {
receive: 0.000003003690036900369,
transmit: 4.723247232472324e-7
}
}
]
Temperatures: {
cpu: 45.2,
gpu: 60.8,
}