@oof2510/osinfo v1.0.3
osinfo
An NPM module to get OS/PC info
Installation
Yarn
yarn add @oof2510/osinfo
NPM
npm i @oof2510/osinfo --save
Example code to log the CPU temperature
const osinfo = require("@oof2510/osinfo");
console.log(osinfo.system.cpuTemp);
Docs
Functions
formatBytes(bytes, decimals)
- Formats bytes to the appropriate unit. Decimals defaults to 2.
formatMilliseconds(milliseconds)
- Formats milliseconds to the appropriate unit.
isLinux()
- Returns true if os is linux, false otherwise.
Properties
system.uptime
- System uptime
system.memUsage
- System memory usage
system.cpuTemp
- CPU temperature in celcius
system.totalMem
- Total system memory in bytes
system.freeMem
- Free system memory in bytes
process.uptime
- Uptime of the nodejs process
process.memUsage
- Amount of memory that the nodejs process is using
os.platform
- Exactly the same as nodejs's os.platform()
os.linuxDistro
- The name of the linux distro; if on linux
os.arch
- Exactly the same as nodejs's os.arch()
os.release
- Exactly the same as nodejs's os.release()
os.version
- Exactly the same as nodejs's os.version()
nodejsVersion
- The version of nodejs that is installed