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';
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'
.
Returns an estimate of the default amount of parallelism a program should use. Always returns a value greater than zero.
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.
Returns a string identifying the endianness of the CPU for which the Node.js binary was compiled.
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.
Returns the machine type as a string, such as arm
, arm64
, aarch64
, mips
, mips64
, ppc64
, ppc64le
, s390
, s390x
, i386
, i686
, x86_64
.
Returns an object containing network interfaces that have been assigned a network address.
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'
.
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.
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
.