lup-system
Version:
NodeJS library to retrieve system information and utilization.
25 lines (24 loc) • 862 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getOSInfo = getOSInfo;
const os_1 = __importDefault(require("os"));
/**
* Returns information about the operating system.
*
* @returns Operating system information.
*/
async function getOSInfo() {
return {
name: os_1.default.type().replaceAll('_NT', ''), // normalize name
version: os_1.default.release(),
architecture: os_1.default.arch(),
machine: os_1.default.machine(),
platform: os_1.default.platform(),
bits: os_1.default.arch().includes('64') ? 64 : 32,
hostname: os_1.default.hostname(),
uptime: new Date(Date.now() - os_1.default.uptime() * 1000),
};
}
;