NodeJs之OS

NodeJs版本:4.4.4

OS


Node.js提供了一些基本的底层操作系统的模块OS.

API

var os = require('os');
console.log('[arch] 操作系统CPU架构'+os.arch());
console.log('[cpus] 每个CPU/内核的信息:'+JSON.stringify(os.cpus()));
console.log('[endianness] CPU 的字节序:'+os.endianness());
console.log('[freemem] 操作系统空闲内存量:'+os.freemem());
console.log('[homedir] 当前用户使用的文件夹:'+os.homedir());
console.log('[hostname] 操作系统的主机名:'+os.hostname());
console.log('[loadavg] 平均负载:'+os.loadavg());
console.log('[networkInterfaces] 网络接口:'+JSON.stringify(os.networkInterfaces()));
console.log('[platform] 操作系统名:'+os.platform());
console.log('[release] 操作系统的发行版本:'+os.release());
console.log('[tmpdir] 操作系统的默认临时文件夹:'+os.tmpdir());
console.log('[totalmem] 系统内存总量:'+os.totalmem());
console.log('[type] 操作系统名:'+os.type());
console.log('[uptime] 操作系统运行的时间:'+os.uptime());
[arch] 操作系统CPU架构x64
[cpus] 每个CPU/内核的信息:[{"model":"Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz","speed":2794,"times":{"user":12349500,"nice":0,"sys":13773515,"idle":76721437,"irq":1744218}},{"model":"Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz","speed":2794,"times":{"user":12447781,"nice":0,"sys":11801625,"idle":78594843,"irq":320156}},{"model":"Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz","speed":2794,"times":{"user":13889359,"nice":0,"sys":12343843,"idle":76611046,"irq":141578}},{"model":"Intel(R) Core(TM) i5-4200H CPU @ 2.80GHz","speed":2794,"times":{"user":12556328,"nice":0,"sys":11338265,"idle":78949640,"irq":128375}}]
[endianness] CPU 的字节序:LE
[freemem] 操作系统空闲内存量:2904788992
[homedir] 当前用户使用的文件夹:C:\Users\Administrator
[hostname] 操作系统的主机名:SKYUSER-9PEIINO
[loadavg] 平均负载:0,0,0
[networkInterfaces] 网络接口:{"VMware Network Adapter VMnet1":[{"address":"xxxxxxxxxxx","netmask":"ffff:ffff:ffff:ffff::","family":"IPv6","mac":"00:50:56:c0:00:01","scopeid":21,"internal":false},{"address":"192.168.80.1","netmask":"255.255.255.0","family":"IPv4","mac":"00:50:56:c0:00:01","internal":false}],"VMware Network Adapter VMnet8":
.......,"scopeid":0,"internal":false},{"address":"fe80::8cd:96a1:2214:bcfb","netmask":"ffff:ffff:ffff:ffff::","family":"IPv6","mac":"00:00:00:00:00:00","scopeid":8,"internal":false}]}
[platform] 操作系统名:win32
[release] 操作系统的发行版本:10.0.10240
[tmpdir] 操作系统的默认临时文件夹:C:\Users\ADMINI~1\AppData\Local\Temp
[totalmem] 系统内存总量:8473526272
[type] 操作系统名:Windows_NT
[uptime] 操作系统运行的时间:501123.2912315

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lmr廖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值