os(opertion system)操作系统,是node.js里的核心模块,提供了操作系统相关的使用方法。
1
| const os = require('os')
|
目前支持的方法如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| const os = require('os')
let arch = os.arch() console.log('arch: ', arch)
let constants = os.constants console.log('constants: ', constants)
let cpus = os.cpus() console.log('cpus: ', cpus)
let endianness = os.endianness() console.log('node endianness: ', endianness)
let freemem = os.freemem() console.log('node freemem: ', freemem)
let priority = os.getPriority() console.log('pid priority: ', priority)
let homedir = os.homedir() console.log('node homedir: ', homedir)
let hostname = os.hostname() console.log('node hostname: ', hostname)
let loadavg = os.loadavg() console.log('node loadavg: ', loadavg)
let networkInterfaces = os.networkInterfaces() console.log('networkInterfaces: ', networkInterfaces)
let platform = os.platform() console.log('platform: ', platform)
let release = os.release() console.log('release: ', release)
let tmpdir = os.tmpdir() console.log('tmpdir: ', tmpdir)
let totalmem = os.totalmem() console.log('totalmem: ', totalmem)
let type = os.type() console.log('type: ', type)
let uptime = os.uptime() console.log('uptime: ', uptime)
let userInfo = os.userInfo() console.log('userInfo: ', userInfo)
|
信号常量