The os
module provides a number of operating system-related utility methods.
See also:
Static variables
staticread onlyEOL:String
A string constant defining the operating system-specific end-of-line marker:
See also:
staticread onlyconstants:OsConstants
Returns an object containing commonly used operating system specific constants for error codes, process signals, and so on. The specific constants currently defined are described in OS Constants.
See also:
Static methods
staticarch():String
The os.arch()
method returns a string identifying the operating system CPU architecture for which the Node.js binary was compiled.
See also:
staticcpus():Array<CPU>
The os.cpus()
method returns an array of objects containing information about each logical CPU core.
See also:
staticendianness():Endianness
The os.endianness()
method returns a string identifying the endianness of the CPU for which the Node.js binary was compiled.
See also:
staticfreemem():Int
The os.freemem()
method returns the amount of free system memory in bytes as an integer.
See also:
staticgetPriority(?pid:Int):Int
The os.getPriority()
method returns the scheduling priority for the process specified by pid
. If pid
is not provided, or is 0
, the priority of the current process is returned.
See also:
statichomedir():String
The os.homedir()
method returns the home directory of the current user as a string.
See also:
statichostname():String
The os.hostname()
method returns the hostname of the operating system as a string.
See also:
staticloadavg():Array<Float>
The os.loadavg()
method returns an array containing the 1, 5, and 15 minute load averages.
See also:
staticnetworkInterfaces():DynamicAccess<NetworkInterface>
The os.networkInterfaces()
method returns an object containing only network interfaces that have been assigned a network address.
See also:
staticplatform():String
The os.platform()
method returns a string identifying the operating system platform as set during compile time of Node.js.
See also:
staticrelease():String
The os.release()
method returns a string identifying the operating system release.
See also:
staticsetPriority(?pid:Int, priority:Int):Void
The os.setPriority()
method attempts to set the scheduling priority for the process specified by pid
. If pid
is not provided, or is 0
, the priority of the current process is used.
See also:
statictmpdir():String
The os.tmpdir()
method returns a string specifying the operating system's default directory for temporary files.
See also:
statictotalmem():Int
The os.totalmem()
method returns the total amount of system memory in bytes as an integer.
See also:
statictype():String
The os.type()
method returns a string identifying the operating system name as returned by uname(3). For example, 'Linux'
on Linux, 'Darwin'
on macOS, and 'Windows_NT'
on Windows.
See also:
staticuserInfo(?options:{encoding:String}):OsUserInfo
The os.userInfo()
method returns information about the currently effective user — on POSIX platforms, this is typically a subset of the password file. The returned object includes the username
, uid
, gid
, shell
, and homedir
. On Windows, the uid
and gid
fields are -1
, and shell
is null
.
See also: