Node.js Process Complete Reference
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 const 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() Method | This is used to get the user, and system CPU time usage of the current process. |
Node.js process.cwd() Method | This is used to get the current working directory of the node.js process. |
Node.js process.getegid() Method | This is used to get the numerical effective group identity of the Node.js process. |
Node.js process.geteuid() Method | This is used to get the numerical effective user identity of the Node.js process. |
Node.js process.getgid() Method | This is used to get the numerical group identity of the Node.js process. |
Node.js process.getgroups() Method | This is used to get the supplementary group IDs. |
Node.js process.getuid() Method | This is used to get the numerical user identity of the Node.js process. |
Node.js process.hasUncaughtExceptionCaptureCallback() Method | This is used to get whether a callback has been set using the process |
Node.js process.setegid() Method | This is used to set the numerical effective group identity of the Node.js process. |
Node.js process.seteuid() Method | This is used to set the effective user identity of the Node.js process. |
Node.js process.setgid() Method | This is used to set the group identity of the Node.js process. |
Node.js process.setgroups() Method | This is used to set the supplementary group IDs. |
Node.js process.setuid() Method | This is used to set the user identity of the Node.js process. |
Node.js process.setUncaughtExceptionCaptureCallback() Method | This is used to set a callback function that will be called when an Uncaught Exception occurs. |
Node.js process.uptime() Method | This is used to get the number of seconds the Node.js process is running. |
Node.js Process (Property) | Description |
---|---|
Node.js process.arch Property | This is used to get the CPU architecture of the computer for which the current node.js is compiled. |
Node.js process.argv Property | This is used to get the arguments passed to the node.js process when run in the command line. |
Node.js process.argv0 Property | This is used to get the read-only copy of the original value of argv[0] passed to the node.js |
Node.js process.config Property | This 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 Property | This is used to get the debugging port used by the debugger if enabled. |
Node.js process.env Property | This 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 Property | This is used to get the main module. |
Node.js process.pid Property | This is used to get the PID of the process. |
Node.js process.platform Property | This 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 Property | This is used to get the metadata related to the current release of node.js. |
Node.js process.title Property | This 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 Property | This is used to get the versions of node.js modules and their dependencies. |
Please Login to comment...