Open In App

Node.js Process Complete Reference

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

A process object is a global object that gives information about and controls the node.js process. As it is global, it can be used in the project without importing it from any module. 

Example:

Javascript
// Node.js program to demonstrate the
// process.versions property

// Include process module
const process = require('process');

// Printing process.versions property value
// and variable count
let no_versions = 0;

// Calling process.versions property
const versions = process.versions;

// Iterating through all returned data
for (let key in versions) {
    // Printing key and its versions
    console.log(key + ":\t\t\t" + versions[key]);
    no_versions++;
}

// Printing count value
console.log("Total no of values available = " + no_versions);

Output:

http_parser:            2.8.0
node: 10.16.0
v8: 6.8.275.32-node.52
uv: 1.28.0
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 64
nghttp2: 1.34.0
napi: 4
openssl: 1.1.1b
icu: 64.2
unicode: 12.1
cldr: 35.1
tz: 2019a
Total no of values available = 15

The Complete List of Processes is listed below:

Node.js Process (Method)

Description
Node.js process.chdir() Method This is used to change the current working directory.
Node.js process.cpuUsage() MethodThis is used to get the user, and system CPU time usage of the current process.
Node.js process.cwd() MethodThis is used to get the current working directory of the node.js process. 
Node.js process.getegid() MethodThis is used to get the numerical effective group identity of the Node.js process.
Node.js process.geteuid() MethodThis is used to get the numerical effective user identity of the Node.js process.
Node.js process.getgid() MethodThis is used to get the numerical group identity of the Node.js process.
Node.js process.getgroups() MethodThis is used to get the supplementary group IDs.
Node.js process.getuid() MethodThis is used to get the numerical user identity of the Node.js process.
Node.js process.hasUncaughtExceptionCaptureCallback() MethodThis is used to get whether a callback has been set using the process
Node.js process.setegid() MethodThis is used to set the numerical effective group identity of the Node.js process.
Node.js process.seteuid() MethodThis is used to set the effective user identity of the Node.js process.
Node.js process.setgid() MethodThis is used to set the group identity of the Node.js process.
Node.js process.setgroups() MethodThis is used to set the supplementary group IDs.
Node.js process.setuid() MethodThis is used to set the user identity of the Node.js process.
Node.js process.setUncaughtExceptionCaptureCallback() MethodThis is used to set a callback function that will be called when an Uncaught Exception occurs.
Node.js process.uptime() MethodThis is used to get the number of seconds the Node.js process is running.

Node.js Process (Property)

Description

Node.js process.arch PropertyThis is used to get the CPU architecture of the computer for which the current node.js is compiled.
Node.js process.argv PropertyThis is used to get the arguments passed to the node.js process when run in the command line.
Node.js process.argv0 PropertyThis is used to get the read-only copy of the original value of argv[0] passed to the node.js 
Node.js process.config PropertyThis is used to get the JavaScript representation of the configure options that are used to compile the current node.js code.
Node.js process.debugPort PropertyThis is used to get the debugging port used by the debugger if enabled.
Node.js process.env PropertyThis is used to get the user environment. 
Node.js process.execArgv Property This is used to get the node.js specific command-line options passed to the node.js process during launch.
Node.js process.execPath Property This is used to get the absolute pathname of the node.js executable which started the node.js process.
Node.js process.mainModule PropertyThis is used to get the main module. 
Node.js process.pid PropertyThis is used to get the PID of the process.
Node.js process.platform PropertyThis is used to get the Operating System platform information.
Node.js process.ppid Property This is used to get the PID of the current parent process.
Node.js process.release PropertyThis is used to get the metadata related to the current release of node.js.
Node.js process.title PropertyThis is used to get and set the title of the process.
Node.js process.version Property This is used to check the node.js version.
Node.js process.versions PropertyThis is used to get the versions of node.js modules and their dependencies.


Last Updated : 15 Mar, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads