Process

Memory usage snapshot returned by process.memoryUsage().

Module: node:process Support: Experimental Since: 1.1.0 Docs: Node.js Docs

29 members: 15 supported, 14 undocumented

Static Methods

🟢 abort()
Terminates the process immediately with a core dump (SIGABRT).
🟢 cwd()
Returns the current working directory of the process.
🟢 chdir(directory)
Changes the current working directory of the process.
🟢 exit(code)
Terminates the process with the given exit code.
🟢 getuid()
Returns the numeric user ID of the process owner.
🟢 getgid()
Returns the numeric group ID of the process owner.
🟢 geteuid()
Returns the effective numeric user ID.
🟢 getegid()
Returns the effective numeric group ID.
🟢 hrtime(time)
Returns the current high-resolution time as [seconds, nanoseconds].
🟢 umask(mask)
Gets or sets the file creation mode mask.
🟢 cpuUsage(previousValue)
Returns the CPU time used since an optional reference point.
🟢 memoryUsage()
Returns a snapshot of the current process memory usage.
🟢 uptime()
Returns the number of seconds the current process has been running.
🟢 nextTick(callback)
Schedules a callback to run after I/O events but before timers in the current event loop tick.

Properties

⚪ arch
CPU architecture of the process (e.g. "x64", "arm64"). @compat elide Full
⚪ argv
Command-line arguments passed to the process, starting with the node executable path. @compat elide Full
⚪ argv0
The original value of argv[0] before any modification by Node.js. @compat elide Full
⚪ env
Object containing the process environment variables. @compat elide Full
⚪ execArgv
Node.js-specific flags passed to the node executable. @compat elide Full
⚪ execPath
Absolute path of the node executable. @compat elide Full
⚪ pid
Process ID. @compat elide Full
⚪ ppid
Parent process ID. @compat elide Full
⚪ platform
Parent process ID. @compat elide Full
⚪ title
Operating system platform (e.g. "linux", "darwin", "win32"). @compat elide Full
⚪ version
Displayed process title (settable in most environments). @compat elide Full
⚪ versions
Object mapping dependency names to their version strings. @compat elide Full
🟢 stdin
Schedules a callback to run after I/O events but before timers in the current event loop tick.
⚪ stdout
Readable stream connected to stdin. @compat elide Full
⚪ stderr
Writable stream connected to stdout. @compat elide Full

---

Details

abort()

static abort()

static abort()

Terminates the process immediately with a core dump (SIGABRT).

> Known issue: Not supported in all environments; behavior is platform-specific

chdir(directory)

static chdir(directory: string)

static chdir(directory: string)

Changes the current working directory of the process.
ParameterTypeDescription
directorystringAbsolute or relative path to change to
Throws:
  • Error --- If the directory does not exist or is inaccessible

getuid()

static getuid(): u32

static getuid(): u32

Returns the numeric user ID of the process owner.

Returns: u32 UID integer

> Known issue: Always returns 0 on Windows

getgid()

static getgid(): u32

static getgid(): u32

Returns the numeric group ID of the process owner.

Returns: u32 GID integer

> Known issue: Always returns 0 on Windows

geteuid()

static geteuid(): u32

static geteuid(): u32

Returns the effective numeric user ID.

Returns: u32 Effective UID integer

> Known issue: Always returns 0 on Windows

getegid()

static getegid(): u32

static getegid(): u32

Returns the effective numeric group ID.

Returns: u32 Effective GID integer

> Known issue: Always returns 0 on Windows

Dictionary CpuUsage

CPU usage snapshot returned by process.cpuUsage().

Since: 1.1.0 Docs: Node.js Docs

2 members: 2 undocumented

Properties

⚪ user
User CPU time consumed in microseconds. @compat elide Full
⚪ system
System CPU time consumed in microseconds. @compat elide Full

---

Dictionary MemoryUsage

Memory usage snapshot returned by process.memoryUsage().

Since: 1.1.0 Docs: Node.js Docs

5 members: 5 undocumented

Properties

⚪ rss
Resident set size — total memory allocated for the process in bytes. @compat elide Full
⚪ heapTotal
Total size of the V8 heap in bytes. @compat elide Full
⚪ heapUsed
V8 heap memory currently in use, in bytes. @compat elide Full
⚪ external
Memory used by C++ objects bound to JS objects, in bytes. @compat elide Full
⚪ arrayBuffers
Memory used by ArrayBuffer and SharedArrayBuffer instances, in bytes. @compat elide Full

---