// import { AuthMail, DataMail, EsquemaTrabajo } from "./types"; import { networkInterfaces, totalmem,cpus } from 'os'; import getMAC from 'getmac' export namespace Machine { export const totalRam = () => { return (Math.round(totalmem()/1000000)).toString()+'MB'; } export const getCpu = () => { return cpus()[0].model; } export const getCpuSpeed = () => { return cpus()[0].speed / 1000 + 'GHZ'; } export const getMacAddress = () => { return getMAC(); } export const getIp = () => { const interfaces = networkInterfaces(); const addresses = []; Object.keys(interfaces).forEach((netInterface) => { interfaces[netInterface].forEach((interfaceObject) => { if (interfaceObject.family === 'IPv4' && !interfaceObject.internal) { addresses.push(interfaceObject.address); } }); }); return (addresses[0]); } }