jormungandr-bite/src/misc/machineInfo.ts

18 lines
624 B
TypeScript
Raw Normal View History

2016-12-30 11:19:59 -07:00
import * as os from 'os';
import Logger from './logger';
2018-11-05 11:31:16 -07:00
import * as sysUtils from 'systeminformation';
2016-12-30 11:19:59 -07:00
2017-01-02 12:39:44 -07:00
export default class {
2018-11-05 11:31:16 -07:00
public static async show() {
2017-05-24 05:50:17 -06:00
const logger = new Logger('Machine');
2017-01-02 12:35:32 -07:00
logger.info(`Hostname: ${os.hostname()}`);
logger.info(`Platform: ${process.platform}`);
logger.info(`Architecture: ${process.arch}`);
2018-07-14 07:53:30 -06:00
logger.info(`CPU: ${os.cpus().length} core`);
2018-11-05 11:31:16 -07:00
const mem = await sysUtils.mem();
const totalmem = (mem.total / 1024 / 1024 / 1024).toFixed(1);
const availmem = (mem.available / 1024 / 1024 / 1024).toFixed(1);
logger.info(`MEM: ${totalmem}GB (available: ${availmem}GB)`);
2016-12-30 11:19:59 -07:00
}
}