5 Provides a few basic operating-system related utility functions.
7 Use `require('os')` to access this module.
11 Returns the operating system's default directory for temporary files.
15 Returns the home directory of the current user.
19 Returns the endianness of the CPU. Possible values are `'BE'` for big endian
20 or `'LE'` for little endian.
24 Returns the hostname of the operating system.
28 Returns the operating system name. For example `'Linux'` on Linux, `'Darwin'`
29 on OS X and `'Windows_NT'` on Windows.
33 Returns the operating system platform. Possible values are `'darwin'`,
34 `'freebsd'`, `'linux'`, `'sunos'` or `'win32'`. Returns the value of
39 Returns the operating system CPU architecture. Possible values are `'x64'`,
40 `'arm'` and `'ia32'`. Returns the value of `process.arch`.
44 Returns the operating system release.
48 Returns the system uptime in seconds.
52 Returns an array containing the 1, 5, and 15 minute load averages.
54 The load average is a measure of system activity, calculated by the operating
55 system and expressed as a fractional number. As a rule of thumb, the load
56 average should ideally be less than the number of logical CPUs in the system.
58 The load average is a very UNIX-y concept; there is no real equivalent on
59 Windows platforms. That is why this function always returns `[0, 0, 0]` on
64 Returns the total amount of system memory in bytes.
68 Returns the amount of free system memory in bytes.
72 Returns an array of objects containing information about each CPU/core
73 installed: model, speed (in MHz), and times (an object containing the number of
74 milliseconds the CPU/core spent in: user, nice, sys, idle, and irq).
76 Example inspection of os.cpus:
78 [ { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
86 { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
94 { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
102 { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
110 { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
118 { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
126 { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
134 { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
143 Note that since `nice` values are UNIX centric in Windows the `nice` values of
144 all processors are always 0.
146 ## os.networkInterfaces()
148 Get a list of network interfaces:
151 [ { address: '127.0.0.1',
152 netmask: '255.0.0.0',
154 mac: '00:00:00:00:00:00',
157 netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
159 mac: '00:00:00:00:00:00',
162 [ { address: '192.168.1.108',
163 netmask: '255.255.255.0',
165 mac: '01:02:03:0a:0b:0c',
167 { address: 'fe80::a00:27ff:fe4e:66a1',
168 netmask: 'ffff:ffff:ffff:ffff::',
170 mac: '01:02:03:0a:0b:0c',
171 internal: false } ] }
173 Note that due to the underlying implementation this will only return network
174 interfaces that have been assigned an address.
178 A constant defining the appropriate End-of-line marker for the operating