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

posted on 2016-12-10 16:23 qize 阅读(...) 评论(...) 编辑 收藏

导航

公告