Skip to main content
os - Node documentation

Usage in Deno

import * as mod from "node:os";

The node:os module provides operating system-related utility methods and properties. It can be accessed using:

import os from 'node:os';

Functions

f
arch

Returns the operating system CPU architecture for which the Node.js binary was compiled. Possible values are 'arm', 'arm64', 'ia32', 'loong64', 'mips', 'mipsel', 'ppc', 'ppc64', 'riscv64', 's390', 's390x', and 'x64'.

f
availableParallelism

Returns an estimate of the default amount of parallelism a program should use. Always returns a value greater than zero.

f
cpus

Returns an array of objects containing information about each logical CPU core. The array will be empty if no CPU information is available, such as if the /proc file system is unavailable.

f
endianness

Returns a string identifying the endianness of the CPU for which the Node.js binary was compiled.

f
freemem

Returns the amount of free system memory in bytes as an integer.

f
getPriority

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.

f
homedir

Returns the string path of the current user's home directory.

f
hostname

Returns the host name of the operating system as a string.

f
loadavg

Returns an array containing the 1, 5, and 15 minute load averages.

f
machine

Returns the machine type as a string, such as arm, arm64, aarch64, mips, mips64, ppc64, ppc64le, s390, s390x, i386, i686, x86_64.

f
networkInterfaces

Returns an object containing network interfaces that have been assigned a network address.

f
platform

Returns a string identifying the operating system platform for which the Node.js binary was compiled. The value is set at compile time. Possible values are 'aix', 'darwin', 'freebsd', 'linux', 'openbsd', 'sunos', and 'win32'.

f
release

Returns the operating system as a string.

f
setPriority

Attempts to set the scheduling priority for the process specified by pid. If pid is not provided or is 0, the process ID of the current process is used.

f
tmpdir

Returns the operating system's default directory for temporary files as a string.

f
totalmem

Returns the total amount of system memory in bytes as an integer.

f
type

Returns the operating system name as returned by uname(3). For example, it returns 'Linux' on Linux, 'Darwin' on macOS, and 'Windows_NT' on Windows.

f
uptime

Returns the system uptime in number of seconds.

f
userInfo

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.

f
version

Returns a string identifying the kernel version.

Interfaces

I
CpuInfo

The node:os module provides operating system-related utility methods and properties. It can be accessed using:

I
NetworkInterfaceInfoIPv4
No documentation available
I
NetworkInterfaceInfoIPv6
No documentation available
I
UserInfo
No documentation available

Namespaces

N
constants
No documentation available
N
constants.dlopen
No documentation available
N
constants.errno
No documentation available
N
constants.priority
No documentation available
N
v
constants.signals
No documentation available

Type Aliases

T
NetworkInterfaceInfo
No documentation available
T
SignalConstants
No documentation available

Variables

v
constants.dlopen.RTLD_DEEPBIND
No documentation available
v
constants.dlopen.RTLD_GLOBAL
No documentation available
v
constants.dlopen.RTLD_LAZY
No documentation available
v
constants.dlopen.RTLD_LOCAL
No documentation available
v
constants.dlopen.RTLD_NOW
No documentation available
v
constants.errno.E2BIG
No documentation available
v
constants.errno.EACCES
No documentation available
v
constants.errno.EADDRINUSE
No documentation available
v
constants.errno.EADDRNOTAVAIL
No documentation available
v
constants.errno.EAFNOSUPPORT
No documentation available
v
constants.errno.EAGAIN
No documentation available
v
constants.errno.EALREADY
No documentation available
v
constants.errno.EBADF
No documentation available
v
constants.errno.EBADMSG
No documentation available
v
constants.errno.EBUSY
No documentation available
v
constants.errno.ECANCELED
No documentation available
v
constants.errno.ECHILD
No documentation available
v
constants.errno.ECONNABORTED
No documentation available
v
constants.errno.ECONNREFUSED
No documentation available
v
constants.errno.ECONNRESET
No documentation available
v
constants.errno.EDEADLK
No documentation available
v
constants.errno.EDESTADDRREQ
No documentation available
v
constants.errno.EDOM
No documentation available
v
constants.errno.EDQUOT
No documentation available
v
constants.errno.EEXIST
No documentation available
v
constants.errno.EFAULT
No documentation available
v
constants.errno.EFBIG
No documentation available
v
constants.errno.EHOSTUNREACH
No documentation available
v
constants.errno.EIDRM
No documentation available
v
constants.errno.EILSEQ
No documentation available
v
constants.errno.EINPROGRESS
No documentation available
v
constants.errno.EINTR
No documentation available
v
constants.errno.EINVAL
No documentation available
v
constants.errno.EIO
No documentation available
v
constants.errno.EISCONN
No documentation available
v
constants.errno.EISDIR
No documentation available
v
constants.errno.ELOOP
No documentation available
v
constants.errno.EMFILE
No documentation available
v
constants.errno.EMSGSIZE
No documentation available
v
constants.errno.EMULTIHOP
No documentation available
v
constants.errno.ENAMETOOLONG
No documentation available
v
constants.errno.ENETDOWN
No documentation available
v
constants.errno.ENETRESET
No documentation available
v
constants.errno.ENETUNREACH
No documentation available
v
constants.errno.ENFILE
No documentation available
v
constants.errno.ENOBUFS
No documentation available
v
constants.errno.ENODATA
No documentation available
v
constants.errno.ENODEV
No documentation available
v
constants.errno.ENOENT
No documentation available
v
constants.errno.ENOEXEC
No documentation available
v
constants.errno.ENOLCK
No documentation available
v
constants.errno.ENOMEM
No documentation available
v
constants.errno.ENOMSG
No documentation available
v
constants.errno.ENOPROTOOPT
No documentation available
v
constants.errno.ENOSPC
No documentation available
v
constants.errno.ENOSR
No documentation available
v
constants.errno.ENOSTR
No documentation available
v
constants.errno.ENOSYS
No documentation available
v
constants.errno.ENOTCONN
No documentation available
v
constants.errno.ENOTDIR
No documentation available
v
constants.errno.ENOTEMPTY
No documentation available
v
constants.errno.ENOTSOCK
No documentation available
v
constants.errno.ENOTSUP
No documentation available
v
constants.errno.ENOTTY
No documentation available
v
constants.errno.ENXIO
No documentation available
v
constants.errno.EOPNOTSUPP
No documentation available
v
constants.errno.EOVERFLOW
No documentation available
v
constants.errno.EPERM
No documentation available
v
constants.errno.EPIPE
No documentation available
v
constants.errno.EPROTO
No documentation available
v
constants.errno.EPROTONOSUPPORT
No documentation available
v
constants.errno.EPROTOTYPE
No documentation available
v
constants.errno.ERANGE
No documentation available
v
constants.errno.EROFS
No documentation available
v
constants.errno.ESPIPE
No documentation available
v
constants.errno.ESRCH
No documentation available
v
constants.errno.ESTALE
No documentation available
v
constants.errno.ETIME
No documentation available
v
constants.errno.ETIMEDOUT
No documentation available
v
constants.errno.ETXTBSY
No documentation available
v
constants.errno.EWOULDBLOCK
No documentation available
v
constants.errno.EXDEV
No documentation available
v
constants.errno.WSA_E_CANCELLED
No documentation available
v
constants.errno.WSA_E_NO_MORE
No documentation available
v
constants.errno.WSAEACCES
No documentation available
v
constants.errno.WSAEADDRINUSE
No documentation available
v
constants.errno.WSAEADDRNOTAVAIL
No documentation available
v
constants.errno.WSAEAFNOSUPPORT
No documentation available
v
constants.errno.WSAEALREADY
No documentation available
v
constants.errno.WSAEBADF
No documentation available
v
constants.errno.WSAECANCELLED
No documentation available
v
constants.errno.WSAECONNABORTED
No documentation available
v
constants.errno.WSAECONNREFUSED
No documentation available
v
constants.errno.WSAECONNRESET
No documentation available
v
constants.errno.WSAEDESTADDRREQ
No documentation available
v
constants.errno.WSAEDISCON
No documentation available
v
constants.errno.WSAEDQUOT
No documentation available
v
constants.errno.WSAEFAULT
No documentation available
v
constants.errno.WSAEHOSTDOWN
No documentation available
v
constants.errno.WSAEHOSTUNREACH
No documentation available
v
constants.errno.WSAEINPROGRESS
No documentation available
v
constants.errno.WSAEINTR
No documentation available
v
constants.errno.WSAEINVAL
No documentation available
v
constants.errno.WSAEINVALIDPROCTABLE
No documentation available
v
constants.errno.WSAEINVALIDPROVIDER
No documentation available
v
constants.errno.WSAEISCONN
No documentation available
v
constants.errno.WSAELOOP
No documentation available
v
constants.errno.WSAEMFILE
No documentation available
v
constants.errno.WSAEMSGSIZE
No documentation available
v
constants.errno.WSAENAMETOOLONG
No documentation available
v
constants.errno.WSAENETDOWN
No documentation available
v
constants.errno.WSAENETRESET
No documentation available
v
constants.errno.WSAENETUNREACH
No documentation available
v
constants.errno.WSAENOBUFS
No documentation available
v
constants.errno.WSAENOMORE
No documentation available
v
constants.errno.WSAENOPROTOOPT
No documentation available
v
constants.errno.WSAENOTCONN
No documentation available
v
constants.errno.WSAENOTEMPTY
No documentation available
v
constants.errno.WSAENOTSOCK
No documentation available
v
constants.errno.WSAEOPNOTSUPP
No documentation available
v
constants.errno.WSAEPFNOSUPPORT
No documentation available
v
constants.errno.WSAEPROCLIM
No documentation available
v
constants.errno.WSAEPROTONOSUPPORT
No documentation available
v
constants.errno.WSAEPROTOTYPE
No documentation available
v
constants.errno.WSAEPROVIDERFAILEDINIT
No documentation available
v
constants.errno.WSAEREFUSED
No documentation available
v
constants.errno.WSAEREMOTE
No documentation available
v
constants.errno.WSAESHUTDOWN
No documentation available
v
constants.errno.WSAESOCKTNOSUPPORT
No documentation available
v
constants.errno.WSAESTALE
No documentation available
v
constants.errno.WSAETIMEDOUT
No documentation available
v
constants.errno.WSAETOOMANYREFS
No documentation available
v
constants.errno.WSAEUSERS
No documentation available
v
constants.errno.WSAEWOULDBLOCK
No documentation available
v
constants.errno.WSANOTINITIALISED
No documentation available
v
constants.errno.WSASERVICE_NOT_FOUND
No documentation available
v
constants.errno.WSASYSCALLFAILURE
No documentation available
v
constants.errno.WSASYSNOTREADY
No documentation available
v
constants.errno.WSATYPE_NOT_FOUND
No documentation available
v
constants.errno.WSAVERNOTSUPPORTED
No documentation available
v
constants.priority.PRIORITY_ABOVE_NORMAL
No documentation available
v
constants.priority.PRIORITY_BELOW_NORMAL
No documentation available
v
constants.priority.PRIORITY_HIGH
No documentation available
v
constants.priority.PRIORITY_HIGHEST
No documentation available
v
constants.priority.PRIORITY_LOW
No documentation available
v
constants.priority.PRIORITY_NORMAL
No documentation available
v
constants.UV_UDP_REUSEADDR
No documentation available
v
devNull
No documentation available
v
EOL

The operating system-specific end-of-line marker.

Back to top