3 const binding = process.binding('os');
4 const util = require('util');
5 const internalUtil = require('internal/util');
6 const isWindows = process.platform === 'win32';
8 exports.hostname = binding.getHostname;
9 exports.loadavg = binding.getLoadAvg;
10 exports.uptime = binding.getUptime;
11 exports.freemem = binding.getFreeMem;
12 exports.totalmem = binding.getTotalMem;
13 exports.cpus = binding.getCPUs;
14 exports.type = binding.getOSType;
15 exports.release = binding.getOSRelease;
16 exports.networkInterfaces = binding.getInterfaceAddresses;
17 exports.homedir = binding.getHomeDirectory;
20 exports.arch = function() {
24 exports.platform = function() {
25 return process.platform;
28 const trailingSlashRe = isWindows ? /[^:]\\$/
31 exports.tmpdir = function() {
34 path = process.env.TEMP ||
36 (process.env.SystemRoot || process.env.windir) + '\\temp';
38 path = process.env.TMPDIR ||
43 if (trailingSlashRe.test(path))
44 path = path.slice(0, -1);
48 exports.tmpDir = exports.tmpdir;
50 exports.getNetworkInterfaces = internalUtil.deprecate(function() {
51 return exports.networkInterfaces();
52 }, 'os.getNetworkInterfaces is deprecated. ' +
53 'Use os.networkInterfaces instead.');
55 exports.EOL = isWindows ? '\r\n' : '\n';
57 if (binding.isBigEndian)
58 exports.endianness = function() { return 'BE'; };
60 exports.endianness = function() { return 'LE'; };