{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json","id":"process","path":"/process","type":"global","module":null,"title":"Process","introducedIn":"v0.10.0","sourceLink":{"path":"lib/process.js","url":"https://github.com/nodejs/node/blob/HEAD/lib/process.js"},"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `process` object provides information about, and control over, the current\nNode.js process.\n\n```mjs\nimport process from 'node:process';\n```\n\n```cjs\nconst process = require('node:process');\n```","summary":"The `process` object provides information about, and control over, the current Node.js process.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';"},{"language":"cjs","displayName":null,"code":"const process = require('node:process');"}],"children":[{"kind":"section","id":"process-events","name":"Process events","title":"Process events","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `process` object is an instance of [`EventEmitter`](events.html#class-eventemitter).","summary":"The `process` object is an instance of `EventEmitter`.","examples":[],"children":[{"kind":"event","id":"event-beforeexit","name":"beforeExit","title":"Event: `'beforeExit'`","scope":"global","overloadOf":null,"stability":null,"added":["v0.11.12"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[],"description":"The `'beforeExit'` event is emitted when Node.js empties its event loop and has\nno additional work to schedule. Normally, the Node.js process will exit when\nthere is no work scheduled, but a listener registered on the `'beforeExit'`\nevent can make asynchronous calls, and thereby cause the Node.js process to\ncontinue.\n\nThe listener callback function is invoked with the value of\n[`process.exitCode`](#processexitcode_1) passed as the only argument.\n\nThe `'beforeExit'` event is *not* emitted for conditions causing explicit\ntermination, such as calling [`process.exit()`](#processexitcode) or uncaught exceptions.\n\nThe `'beforeExit'` should *not* be used as an alternative to the `'exit'` event\nunless the intention is to schedule additional work.\n\n```mjs\nimport process from 'node:process';\n\nprocess.on('beforeExit', (code) => {\n  console.log('Process beforeExit event with code: ', code);\n});\n\nprocess.on('exit', (code) => {\n  console.log('Process exit event with code: ', code);\n});\n\nconsole.log('This message is displayed first.');\n\n// Prints:\n// This message is displayed first.\n// Process beforeExit event with code: 0\n// Process exit event with code: 0\n```\n\n```cjs\nprocess.on('beforeExit', (code) => {\n  console.log('Process beforeExit event with code: ', code);\n});\n\nprocess.on('exit', (code) => {\n  console.log('Process exit event with code: ', code);\n});\n\nconsole.log('This message is displayed first.');\n\n// Prints:\n// This message is displayed first.\n// Process beforeExit event with code: 0\n// Process exit event with code: 0\n```","summary":"The `'beforeExit'` event is emitted when Node.js empties its event loop and has no additional work to schedule. Normally, the Node.js process will exit when there is no work scheduled, but a listener registered on the `'beforeExit'` event can make asynchronous calls, and thereby cause the Node.js process to continue.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nprocess.on('beforeExit', (code) => {\n  console.log('Process beforeExit event with code: ', code);\n});\n\nprocess.on('exit', (code) => {\n  console.log('Process exit event with code: ', code);\n});\n\nconsole.log('This message is displayed first.');\n\n// Prints:\n// This message is displayed first.\n// Process beforeExit event with code: 0\n// Process exit event with code: 0"},{"language":"cjs","displayName":null,"code":"process.on('beforeExit', (code) => {\n  console.log('Process beforeExit event with code: ', code);\n});\n\nprocess.on('exit', (code) => {\n  console.log('Process exit event with code: ', code);\n});\n\nconsole.log('This message is displayed first.');\n\n// Prints:\n// This message is displayed first.\n// Process beforeExit event with code: 0\n// Process exit event with code: 0"}],"children":[]},{"kind":"event","id":"event-disconnect","name":"disconnect","title":"Event: `'disconnect'`","scope":"global","overloadOf":null,"stability":null,"added":["v0.7.7"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[],"description":"If the Node.js process is spawned with an IPC channel (see the [Child Process](child_process.html)\nand [Cluster](cluster.html) documentation), the `'disconnect'` event will be emitted when\nthe IPC channel is closed.","summary":"If the Node.js process is spawned with an IPC channel (see the Child Process and Cluster documentation), the `'disconnect'` event will be emitted when the IPC channel is closed.","examples":[],"children":[]},{"kind":"event","id":"event-exit","name":"exit","title":"Event: `'exit'`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.7"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"code","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"description":"The `'exit'` event is emitted when the Node.js process is about to exit as a\nresult of either:\n\n* The `process.exit()` method being called explicitly;\n* The Node.js event loop no longer having any additional work to perform.\n\nThere is no way to prevent the exiting of the event loop at this point, and once\nall `'exit'` listeners have finished running the Node.js process will terminate.\n\nThe listener callback function is invoked with the exit code specified either\nby the [`process.exitCode`](#processexitcode_1) property, or the `exitCode` argument passed to the\n[`process.exit()`](#processexitcode) method.\n\n```mjs\nimport process from 'node:process';\n\nprocess.on('exit', (code) => {\n  console.log(`About to exit with code: ${code}`);\n});\n```\n\n```cjs\nprocess.on('exit', (code) => {\n  console.log(`About to exit with code: ${code}`);\n});\n```\n\nListener functions **must** only perform **synchronous** operations. The Node.js\nprocess will exit immediately after calling the `'exit'` event listeners\ncausing any additional work still queued in the event loop to be abandoned.\nIn the following example, for instance, the timeout will never occur:\n\n```mjs\nimport process from 'node:process';\n\nprocess.on('exit', (code) => {\n  setTimeout(() => {\n    console.log('This will not run');\n  }, 0);\n});\n```\n\n```cjs\nprocess.on('exit', (code) => {\n  setTimeout(() => {\n    console.log('This will not run');\n  }, 0);\n});\n```","summary":"The `'exit'` event is emitted when the Node.js process is about to exit as a result of either:","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nprocess.on('exit', (code) => {\n  console.log(`About to exit with code: ${code}`);\n});"},{"language":"cjs","displayName":null,"code":"process.on('exit', (code) => {\n  console.log(`About to exit with code: ${code}`);\n});"},{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nprocess.on('exit', (code) => {\n  setTimeout(() => {\n    console.log('This will not run');\n  }, 0);\n});"},{"language":"cjs","displayName":null,"code":"process.on('exit', (code) => {\n  setTimeout(() => {\n    console.log('This will not run');\n  }, 0);\n});"}],"children":[]},{"kind":"event","id":"event-message","name":"message","title":"Event: `'message'`","scope":"global","overloadOf":null,"stability":null,"added":["v0.5.10"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"message","type":{"text":"Object | boolean | number | string | null","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":9,"end":16},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":19,"end":25},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":28,"end":34},{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":37,"end":41}]},"description":"a parsed JSON object\nor a serializable primitive value.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"sendHandle","type":{"text":"net.Server | net.Socket","links":[{"name":"net.Server","href":"net.html#class-netserver","start":0,"end":10},{"name":"net.Socket","href":"net.html#class-netsocket","start":13,"end":23}]},"description":"a [`net.Server`](net.html#class-netserver) or [`net.Socket`](net.html#class-netsocket)\nobject, or undefined.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"If the Node.js process is spawned with an IPC channel (see the [Child Process](child_process.html)\nand [Cluster](cluster.html) documentation), the `'message'` event is emitted whenever a\nmessage sent by a parent process using [`childprocess.send()`](child_process.html#subprocesssendmessage-sendhandle-options-callback) is received by\nthe child process.\n\nThe message goes through serialization and parsing. The resulting message might\nnot be the same as what is originally sent.\n\nIf the `serialization` option was set to `advanced` used when spawning the\nprocess, the `message` argument can contain data that JSON is not able\nto represent.\nSee [Advanced serialization for `child_process`](child_process.html#advanced-serialization) for more details.","summary":"If the Node.js process is spawned with an IPC channel (see the Child Process and Cluster documentation), the `'message'` event is emitted whenever a message sent by a parent process using `childprocess.send()` is received by the child process.","examples":[],"children":[]},{"kind":"event","id":"event-rejectionhandled","name":"rejectionHandled","title":"Event: `'rejectionHandled'`","scope":"global","overloadOf":null,"stability":null,"added":["v1.4.1"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"promise","type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"The late handled promise.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"The `'rejectionHandled'` event is emitted whenever a `Promise` has been rejected\nand an error handler was attached to it (using [`promise.catch()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch), for\nexample) later than one turn of the Node.js event loop.\n\nThe `Promise` object would have previously been emitted in an\n`'unhandledRejection'` event, but during the course of processing gained a\nrejection handler.\n\nThere is no notion of a top level for a `Promise` chain at which rejections can\nalways be handled. Being inherently asynchronous in nature, a `Promise`\nrejection can be handled at a future point in time, possibly much later than\nthe event loop turn it takes for the `'unhandledRejection'` event to be emitted.\n\nAnother way of stating this is that, unlike in synchronous code where there is\nan ever-growing list of unhandled exceptions, with Promises there can be a\ngrowing-and-shrinking list of unhandled rejections.\n\nIn synchronous code, the `'uncaughtException'` event is emitted when the list of\nunhandled exceptions grows.\n\nIn asynchronous code, the `'unhandledRejection'` event is emitted when the list\nof unhandled rejections grows, and the `'rejectionHandled'` event is emitted\nwhen the list of unhandled rejections shrinks.\n\n```mjs\nimport process from 'node:process';\n\nconst unhandledRejections = new Map();\nprocess.on('unhandledRejection', (reason, promise) => {\n  unhandledRejections.set(promise, reason);\n});\nprocess.on('rejectionHandled', (promise) => {\n  unhandledRejections.delete(promise);\n});\n```\n\n```cjs\nconst unhandledRejections = new Map();\nprocess.on('unhandledRejection', (reason, promise) => {\n  unhandledRejections.set(promise, reason);\n});\nprocess.on('rejectionHandled', (promise) => {\n  unhandledRejections.delete(promise);\n});\n```\n\nIn this example, the `unhandledRejections` `Map` will grow and shrink over time,\nreflecting rejections that start unhandled and then become handled. It is\npossible to record such errors in an error log, either periodically (which is\nlikely best for long-running application) or upon process exit (which is likely\nmost convenient for scripts).","summary":"The `'rejectionHandled'` event is emitted whenever a `Promise` has been rejected and an error handler was attached to it (using `promise.catch()`, for example) later than one turn of the Node.js event loop.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nconst unhandledRejections = new Map();\nprocess.on('unhandledRejection', (reason, promise) => {\n  unhandledRejections.set(promise, reason);\n});\nprocess.on('rejectionHandled', (promise) => {\n  unhandledRejections.delete(promise);\n});"},{"language":"cjs","displayName":null,"code":"const unhandledRejections = new Map();\nprocess.on('unhandledRejection', (reason, promise) => {\n  unhandledRejections.set(promise, reason);\n});\nprocess.on('rejectionHandled', (promise) => {\n  unhandledRejections.delete(promise);\n});"}],"children":[]},{"kind":"event","id":"event-workermessage","name":"workerMessage","title":"Event: `'workerMessage'`","scope":"global","overloadOf":null,"stability":null,"added":["v22.5.0","v20.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"A value transmitted using [`postMessageToThread()`](worker_threads.html#worker_threadspostmessagetothreadthreadid-value-transferlist-timeout).","default":null,"optional":false,"rest":false,"properties":[]},{"name":"source","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The transmitting worker thread ID or `0` for the main thread.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"The `'workerMessage'` event is emitted for any incoming message send by the other\nparty by using [`postMessageToThread()`](worker_threads.html#worker_threadspostmessagetothreadthreadid-value-transferlist-timeout).","summary":"The `'workerMessage'` event is emitted for any incoming message send by the other party by using `postMessageToThread()`.","examples":[],"children":[]},{"kind":"event","id":"event-uncaughtexception","name":"uncaughtException","title":"Event: `'uncaughtException'`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.18"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v12.0.0","v10.17.0"],"prUrl":"https://github.com/nodejs/node/pull/26599","commit":null,"description":"Added the `origin` argument."}],"parameters":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"The uncaught exception.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"origin","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Indicates if the exception originates from an unhandled\nrejection or from a synchronous error. Can either be `'uncaughtException'` or\n`'unhandledRejection'`. The latter is used when an exception happens in a\n`Promise` based async context (or if a `Promise` is rejected) and\n[`--unhandled-rejections`](cli.html#--unhandled-rejectionsmode) flag set to `strict` or `throw` (which is the\ndefault) and the rejection is not handled, or when a rejection happens during\nthe command line entry point's ES module static loading phase.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"The `'uncaughtException'` event is emitted when an uncaught JavaScript\nexception bubbles all the way back to the event loop. By default, Node.js\nhandles such exceptions by printing the stack trace to `stderr` and exiting\nwith code 1, overriding any previously set [`process.exitCode`](#processexitcode_1).\nAdding a handler for the `'uncaughtException'` event overrides this default\nbehavior. Alternatively, change the [`process.exitCode`](#processexitcode_1) in the\n`'uncaughtException'` handler which will result in the process exiting with the\nprovided exit code. Otherwise, in the presence of such handler the process will\nexit with 0.\n\n```mjs\nimport process from 'node:process';\nimport fs from 'node:fs';\n\nprocess.on('uncaughtException', (err, origin) => {\n  fs.writeSync(\n    process.stderr.fd,\n    `Caught exception: ${err}\\n` +\n    `Exception origin: ${origin}\\n`,\n  );\n});\n\nsetTimeout(() => {\n  console.log('This will still run.');\n}, 500);\n\n// Intentionally cause an exception, but don't catch it.\nnonexistentFunc();\nconsole.log('This will not run.');\n```\n\n```cjs\nconst fs = require('node:fs');\n\nprocess.on('uncaughtException', (err, origin) => {\n  fs.writeSync(\n    process.stderr.fd,\n    `Caught exception: ${err}\\n` +\n    `Exception origin: ${origin}\\n`,\n  );\n});\n\nsetTimeout(() => {\n  console.log('This will still run.');\n}, 500);\n\n// Intentionally cause an exception, but don't catch it.\nnonexistentFunc();\nconsole.log('This will not run.');\n```\n\nIt is possible to monitor `'uncaughtException'` events without overriding the\ndefault behavior to exit the process by installing a\n`'uncaughtExceptionMonitor'` listener.","summary":"The `'uncaughtException'` event is emitted when an uncaught JavaScript exception bubbles all the way back to the event loop. By default, Node.js handles such exceptions by printing the stack trace to `stderr` and exiting with code 1, overriding any previously set `process.exitCode`. Adding a handler for the `'uncaughtException'` event overrides this default behavior. Alternatively, change the `process.exitCode` in the `'uncaughtException'` handler which will result in the process exiting with the provided exit code. Otherwise, in the presence of such handler the process will exit with 0.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\nimport fs from 'node:fs';\n\nprocess.on('uncaughtException', (err, origin) => {\n  fs.writeSync(\n    process.stderr.fd,\n    `Caught exception: ${err}\\n` +\n    `Exception origin: ${origin}\\n`,\n  );\n});\n\nsetTimeout(() => {\n  console.log('This will still run.');\n}, 500);\n\n// Intentionally cause an exception, but don't catch it.\nnonexistentFunc();\nconsole.log('This will not run.');"},{"language":"cjs","displayName":null,"code":"const fs = require('node:fs');\n\nprocess.on('uncaughtException', (err, origin) => {\n  fs.writeSync(\n    process.stderr.fd,\n    `Caught exception: ${err}\\n` +\n    `Exception origin: ${origin}\\n`,\n  );\n});\n\nsetTimeout(() => {\n  console.log('This will still run.');\n}, 500);\n\n// Intentionally cause an exception, but don't catch it.\nnonexistentFunc();\nconsole.log('This will not run.');"}],"children":[{"kind":"section","id":"warning-using-uncaughtexception-correctly","name":"Warning: Using 'uncaughtException' correctly","title":"Warning: Using `'uncaughtException'` correctly","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"`'uncaughtException'` is a crude mechanism for exception handling\nintended to be used only as a last resort. The event *should not* be used as\nan equivalent to `On Error Resume Next`. Unhandled exceptions inherently mean\nthat an application is in an undefined state. Attempting to resume application\ncode without properly recovering from the exception can cause additional\nunforeseen and unpredictable issues.\n\nExceptions thrown from within the event handler will not be caught. Instead the\nprocess will exit with a non-zero exit code and the stack trace will be printed.\nThis is to avoid infinite recursion.\n\nAttempting to resume normally after an uncaught exception can be similar to\npulling out the power cord when upgrading a computer. Nine out of ten\ntimes, nothing happens. But the tenth time, the system becomes corrupted.\n\nThe correct use of `'uncaughtException'` is to perform synchronous cleanup\nof allocated resources (e.g. file descriptors, handles, etc) before shutting\ndown the process. **It is not safe to resume normal operation after\n`'uncaughtException'`.**\n\nTo restart a crashed application in a more reliable way, whether\n`'uncaughtException'` is emitted or not, an external monitor should be employed\nin a separate process to detect application failures and recover or restart as\nneeded.","summary":"`'uncaughtException'` is a crude mechanism for exception handling intended to be used only as a last resort. The event _should not_ be used as an equivalent to `On Error Resume Next`. Unhandled exceptions inherently mean that an application is in an undefined state. Attempting to resume application code without properly recovering from the exception can cause additional unforeseen and unpredictable issues.","examples":[],"children":[]}]},{"kind":"event","id":"event-uncaughtexceptionmonitor","name":"uncaughtExceptionMonitor","title":"Event: `'uncaughtExceptionMonitor'`","scope":"global","overloadOf":null,"stability":null,"added":["v13.7.0","v12.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"The uncaught exception.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"origin","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Indicates if the exception originates from an unhandled\nrejection or from synchronous errors. Can either be `'uncaughtException'` or\n`'unhandledRejection'`. The latter is used when an exception happens in a\n`Promise` based async context (or if a `Promise` is rejected) and\n[`--unhandled-rejections`](cli.html#--unhandled-rejectionsmode) flag set to `strict` or `throw` (which is the\ndefault) and the rejection is not handled, or when a rejection happens during\nthe command line entry point's ES module static loading phase.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"The `'uncaughtExceptionMonitor'` event is emitted before an\n`'uncaughtException'` event is emitted or a hook installed via\n[`process.setUncaughtExceptionCaptureCallback()`](#processsetuncaughtexceptioncapturecallbackfn) is called.\n\nInstalling an `'uncaughtExceptionMonitor'` listener does not change the behavior\nonce an `'uncaughtException'` event is emitted. The process will\nstill crash if no `'uncaughtException'` listener is installed.\n\n```mjs\nimport process from 'node:process';\n\nprocess.on('uncaughtExceptionMonitor', (err, origin) => {\n  MyMonitoringTool.logSync(err, origin);\n});\n\n// Intentionally cause an exception, but don't catch it.\nnonexistentFunc();\n// Still crashes Node.js\n```\n\n```cjs\nprocess.on('uncaughtExceptionMonitor', (err, origin) => {\n  MyMonitoringTool.logSync(err, origin);\n});\n\n// Intentionally cause an exception, but don't catch it.\nnonexistentFunc();\n// Still crashes Node.js\n```","summary":"The `'uncaughtExceptionMonitor'` event is emitted before an `'uncaughtException'` event is emitted or a hook installed via `process.setUncaughtExceptionCaptureCallback()` is called.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nprocess.on('uncaughtExceptionMonitor', (err, origin) => {\n  MyMonitoringTool.logSync(err, origin);\n});\n\n// Intentionally cause an exception, but don't catch it.\nnonexistentFunc();\n// Still crashes Node.js"},{"language":"cjs","displayName":null,"code":"process.on('uncaughtExceptionMonitor', (err, origin) => {\n  MyMonitoringTool.logSync(err, origin);\n});\n\n// Intentionally cause an exception, but don't catch it.\nnonexistentFunc();\n// Still crashes Node.js"}],"children":[]},{"kind":"event","id":"event-unhandledrejection","name":"unhandledRejection","title":"Event: `'unhandledRejection'`","scope":"global","overloadOf":null,"stability":null,"added":["v1.4.1"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v7.0.0"],"prUrl":"https://github.com/nodejs/node/pull/8217","commit":null,"description":"Not handling `Promise` rejections is deprecated."},{"versions":["v6.6.0"],"prUrl":"https://github.com/nodejs/node/pull/8223","commit":null,"description":"Unhandled `Promise` rejections will now emit a process warning."}],"parameters":[{"name":"reason","type":{"text":"Error | any","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5},{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":8,"end":11}]},"description":"The object with which the promise was rejected\n(typically an [`Error`](errors.html#class-error) object).","default":null,"optional":false,"rest":false,"properties":[]},{"name":"promise","type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"The rejected promise.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"The `'unhandledRejection'` event is emitted whenever a `Promise` is rejected and\nno error handler is attached to the promise within a turn of the event loop.\nWhen programming with Promises, exceptions are encapsulated as \"rejected\npromises\". Rejections can be caught and handled using [`promise.catch()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch) and\nare propagated through a `Promise` chain. The `'unhandledRejection'` event is\nuseful for detecting and keeping track of promises that were rejected whose\nrejections have not yet been handled.\n\n```mjs\nimport process from 'node:process';\n\nprocess.on('unhandledRejection', (reason, promise) => {\n  console.log('Unhandled Rejection at:', promise, 'reason:', reason);\n  // Application specific logging, throwing an error, or other logic here\n});\n\nsomePromise.then((res) => {\n  return reportToUser(JSON.pasre(res)); // Note the typo (`pasre`)\n}); // No `.catch()` or `.then()`\n```\n\n```cjs\nprocess.on('unhandledRejection', (reason, promise) => {\n  console.log('Unhandled Rejection at:', promise, 'reason:', reason);\n  // Application specific logging, throwing an error, or other logic here\n});\n\nsomePromise.then((res) => {\n  return reportToUser(JSON.pasre(res)); // Note the typo (`pasre`)\n}); // No `.catch()` or `.then()`\n```\n\nThe following will also trigger the `'unhandledRejection'` event to be\nemitted:\n\n```mjs\nimport process from 'node:process';\n\nfunction SomeResource() {\n  // Initially set the loaded status to a rejected promise\n  this.loaded = Promise.reject(new Error('Resource not yet loaded!'));\n}\n\nconst resource = new SomeResource();\n// no .catch or .then on resource.loaded for at least a turn\n```\n\n```cjs\nfunction SomeResource() {\n  // Initially set the loaded status to a rejected promise\n  this.loaded = Promise.reject(new Error('Resource not yet loaded!'));\n}\n\nconst resource = new SomeResource();\n// no .catch or .then on resource.loaded for at least a turn\n```\n\nIn this example case, it is possible to track the rejection as a developer error\nas would typically be the case for other `'unhandledRejection'` events. To\naddress such failures, a non-operational\n[`.catch(() => { })`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch) handler may be attached to\n`resource.loaded`, which would prevent the `'unhandledRejection'` event from\nbeing emitted.\n\nIf an `'unhandledRejection'` event is emitted but not handled it will\nbe raised as an uncaught exception. This alongside other behaviors of\n`'unhandledRejection'` events can changed via the [`--unhandled-rejections`](cli.html#--unhandled-rejectionsmode) flag.","summary":"The `'unhandledRejection'` event is emitted whenever a `Promise` is rejected and no error handler is attached to the promise within a turn of the event loop. When programming with Promises, exceptions are encapsulated as \"rejected promises\". Rejections can be caught and handled using `promise.catch()` and are propagated through a `Promise` chain. The `'unhandledRejection'` event is useful for detecting and keeping track of promises that were rejected whose rejections have not yet been handled.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nprocess.on('unhandledRejection', (reason, promise) => {\n  console.log('Unhandled Rejection at:', promise, 'reason:', reason);\n  // Application specific logging, throwing an error, or other logic here\n});\n\nsomePromise.then((res) => {\n  return reportToUser(JSON.pasre(res)); // Note the typo (`pasre`)\n}); // No `.catch()` or `.then()`"},{"language":"cjs","displayName":null,"code":"process.on('unhandledRejection', (reason, promise) => {\n  console.log('Unhandled Rejection at:', promise, 'reason:', reason);\n  // Application specific logging, throwing an error, or other logic here\n});\n\nsomePromise.then((res) => {\n  return reportToUser(JSON.pasre(res)); // Note the typo (`pasre`)\n}); // No `.catch()` or `.then()`"},{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nfunction SomeResource() {\n  // Initially set the loaded status to a rejected promise\n  this.loaded = Promise.reject(new Error('Resource not yet loaded!'));\n}\n\nconst resource = new SomeResource();\n// no .catch or .then on resource.loaded for at least a turn"},{"language":"cjs","displayName":null,"code":"function SomeResource() {\n  // Initially set the loaded status to a rejected promise\n  this.loaded = Promise.reject(new Error('Resource not yet loaded!'));\n}\n\nconst resource = new SomeResource();\n// no .catch or .then on resource.loaded for at least a turn"}],"children":[]},{"kind":"event","id":"event-warning","name":"warning","title":"Event: `'warning'`","scope":"global","overloadOf":null,"stability":null,"added":["v6.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"warning","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"Key properties of the warning are:","default":null,"optional":false,"rest":false,"properties":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The name of the warning.","default":"'Warning'","optional":true,"rest":false,"properties":[]},{"name":"message","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A system-provided description of the warning.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"stack","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A stack trace to the location in the code where the warning\nwas issued.","default":null,"optional":false,"rest":false,"properties":[]}]}],"description":"The `'warning'` event is emitted whenever Node.js emits a process warning.\n\nA process warning is similar to an error in that it describes exceptional\nconditions that are being brought to the user's attention. However, warnings\nare not part of the normal Node.js and JavaScript error handling flow.\nNode.js can emit warnings whenever it detects bad coding practices that could\nlead to sub-optimal application performance, bugs, or security vulnerabilities.\n\n```mjs\nimport process from 'node:process';\n\nprocess.on('warning', (warning) => {\n  console.warn(warning.name);    // Print the warning name\n  console.warn(warning.message); // Print the warning message\n  console.warn(warning.stack);   // Print the stack trace\n});\n```\n\n```cjs\nprocess.on('warning', (warning) => {\n  console.warn(warning.name);    // Print the warning name\n  console.warn(warning.message); // Print the warning message\n  console.warn(warning.stack);   // Print the stack trace\n});\n```\n\nBy default, Node.js will print process warnings to `stderr`. The `--no-warnings`\ncommand-line option can be used to suppress the default console output but the\n`'warning'` event will still be emitted by the `process` object. Currently, it\nis not possible to suppress specific warning types other than deprecation\nwarnings. To suppress deprecation warnings, check out the [`--no-deprecation`](cli.html#--no-deprecation)\nflag.\n\nThe following example illustrates the warning that is printed to `stderr` when\ntoo many listeners have been added to an event:\n\n```console\n$ node\n> events.defaultMaxListeners = 1;\n> process.on('foo', () => {});\n> process.on('foo', () => {});\n> (node:38638) MaxListenersExceededWarning: Possible EventEmitter memory leak\ndetected. 2 foo listeners added. Use emitter.setMaxListeners() to increase limit\n```\n\nIn contrast, the following example turns off the default warning output and\nadds a custom handler to the `'warning'` event:\n\n```console\n$ node --no-warnings\n> const p = process.on('warning', (warning) => console.warn('Do not do that!'));\n> events.defaultMaxListeners = 1;\n> process.on('foo', () => {});\n> process.on('foo', () => {});\n> Do not do that!\n```\n\nThe `--trace-warnings` command-line option can be used to have the default\nconsole output for warnings include the full stack trace of the warning.\n\nLaunching Node.js using the `--throw-deprecation` command-line flag will\ncause custom deprecation warnings to be thrown as exceptions.\n\nUsing the `--trace-deprecation` command-line flag will cause the custom\ndeprecation to be printed to `stderr` along with the stack trace.\n\nUsing the `--no-deprecation` command-line flag will suppress all reporting\nof the custom deprecation.\n\nThe `*-deprecation` command-line flags only affect warnings that use the name\n`'DeprecationWarning'`.","summary":"The `'warning'` event is emitted whenever Node.js emits a process warning.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nprocess.on('warning', (warning) => {\n  console.warn(warning.name);    // Print the warning name\n  console.warn(warning.message); // Print the warning message\n  console.warn(warning.stack);   // Print the stack trace\n});"},{"language":"cjs","displayName":null,"code":"process.on('warning', (warning) => {\n  console.warn(warning.name);    // Print the warning name\n  console.warn(warning.message); // Print the warning message\n  console.warn(warning.stack);   // Print the stack trace\n});"},{"language":"console","displayName":null,"code":"$ node\n> events.defaultMaxListeners = 1;\n> process.on('foo', () => {});\n> process.on('foo', () => {});\n> (node:38638) MaxListenersExceededWarning: Possible EventEmitter memory leak\ndetected. 2 foo listeners added. Use emitter.setMaxListeners() to increase limit"},{"language":"console","displayName":null,"code":"$ node --no-warnings\n> const p = process.on('warning', (warning) => console.warn('Do not do that!'));\n> events.defaultMaxListeners = 1;\n> process.on('foo', () => {});\n> process.on('foo', () => {});\n> Do not do that!"}],"children":[{"kind":"section","id":"emitting-custom-warnings","name":"Emitting custom warnings","title":"Emitting custom warnings","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"See the [`process.emitWarning()`](#processemitwarningwarning-type-code-ctor) method for issuing\ncustom or application-specific warnings.","summary":"See the `process.emitWarning()` method for issuing custom or application-specific warnings.","examples":[],"children":[]},{"kind":"section","id":"nodejs-warning-names","name":"Node.js warning names","title":"Node.js warning names","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"There are no strict guidelines for warning types (as identified by the `name`\nproperty) emitted by Node.js. New types of warnings can be added at any time.\nA few of the warning types that are most common include:\n\n* `'DeprecationWarning'` - Indicates use of a deprecated Node.js API or feature.\n  Such warnings must include a `'code'` property identifying the\n  [deprecation code](deprecations.html).\n* `'ExperimentalWarning'` - Indicates use of an experimental Node.js API or\n  feature. Such features must be used with caution as they may change at any\n  time and are not subject to the same strict semantic-versioning and long-term\n  support policies as supported features.\n* `'MaxListenersExceededWarning'` - Indicates that too many listeners for a\n  given event have been registered on either an `EventEmitter` or `EventTarget`.\n  This is often an indication of a memory leak.\n* `'TimeoutOverflowWarning'` - Indicates that a numeric value that cannot fit\n  within a 32-bit signed integer has been provided to either the `setTimeout()`\n  or `setInterval()` functions.\n* `'TimeoutNegativeWarning'` - Indicates that a negative number has provided to\n  either the `setTimeout()` or `setInterval()` functions.\n* `'TimeoutNaNWarning'` - Indicates that a value which is not a number has\n  provided to either the `setTimeout()` or `setInterval()` functions.\n* `'UnsupportedWarning'` - Indicates use of an unsupported option or feature\n  that will be ignored rather than treated as an error. One example is use of\n  the HTTP response status message when using the HTTP/2 compatibility API.","summary":"There are no strict guidelines for warning types (as identified by the `name` property) emitted by Node.js. New types of warnings can be added at any time. A few of the warning types that are most common include:","examples":[],"children":[]}]},{"kind":"event","id":"event-worker","name":"worker","title":"Event: `'worker'`","scope":"global","overloadOf":null,"stability":null,"added":["v16.2.0","v14.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"worker","type":{"text":"Worker","links":[{"name":"Worker","href":"worker_threads.html#class-worker","start":0,"end":6}]},"description":"The {Worker} that was created.","default":null,"optional":false,"rest":false,"properties":[]}],"description":"The `'worker'` event is emitted after a new {Worker} thread has been created.","summary":"The `'worker'` event is emitted after a new {Worker} thread has been created.","examples":[],"children":[]},{"kind":"event","id":"signal-events","name":"SIGINT, SIGHUP, etc.","title":"Signal events","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[],"description":"Signal events will be emitted when the Node.js process receives a signal. Please\nrefer to [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a listing of standard POSIX signal names such as `'SIGINT'`, `'SIGHUP'`, etc.\n\nSignals are not available on [`Worker`](worker_threads.html#class-worker) threads.\n\nThe signal handler will receive the signal's name (`'SIGINT'`,\n`'SIGTERM'`, etc.) as the first argument.\n\nThe name of each event will be the uppercase common name for the signal (e.g.\n`'SIGINT'` for `SIGINT` signals).\n\n```mjs\nimport process from 'node:process';\n\n// Begin reading from stdin so the process does not exit.\nprocess.stdin.resume();\n\nprocess.on('SIGINT', () => {\n  console.log('Received SIGINT. Press Control-D to exit.');\n});\n\n// Using a single function to handle multiple signals\nfunction handle(signal) {\n  console.log(`Received ${signal}`);\n}\n\nprocess.on('SIGINT', handle);\nprocess.on('SIGTERM', handle);\n```\n\n```cjs\n// Begin reading from stdin so the process does not exit.\nprocess.stdin.resume();\n\nprocess.on('SIGINT', () => {\n  console.log('Received SIGINT. Press Control-D to exit.');\n});\n\n// Using a single function to handle multiple signals\nfunction handle(signal) {\n  console.log(`Received ${signal}`);\n}\n\nprocess.on('SIGINT', handle);\nprocess.on('SIGTERM', handle);\n```\n\n* `'SIGUSR1'` is reserved by Node.js to start the [debugger](debugger.html). It's possible to\n  install a listener but doing so might interfere with the debugger.\n* `'SIGTERM'` and `'SIGINT'` have default handlers on non-Windows platforms that\n  reset the terminal mode before exiting with code `128 + signal number`. If one\n  of these signals has a listener installed, its default behavior will be\n  removed (Node.js will no longer exit).\n* `'SIGPIPE'` is ignored by default. It can have a listener installed.\n* `'SIGHUP'` is generated on Windows when the console window is closed, and on\n  other platforms under various similar conditions. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html). It can have a\n  listener installed, however Node.js will be unconditionally terminated by\n  Windows about 10 seconds later. On non-Windows platforms, the default\n  behavior of `SIGHUP` is to terminate Node.js, but once a listener has been\n  installed its default behavior will be removed.\n* `'SIGTERM'` is not supported on Windows, it can be listened on.\n* `'SIGINT'` from the terminal is supported on all platforms, and can usually be\n  generated with <kbd>Ctrl</kbd>+<kbd>C</kbd> (though this may be configurable).\n  It is not generated when [terminal raw mode](tty.html#readstreamsetrawmodemode) is enabled\n  and <kbd>Ctrl</kbd>+<kbd>C</kbd> is used.\n* `'SIGBREAK'` is delivered on Windows when <kbd>Ctrl</kbd>+<kbd>Break</kbd> is\n  pressed. On non-Windows platforms, it can be listened on, but there is no way\n  to send or generate it.\n* `'SIGWINCH'` is delivered when the console has been resized. On Windows, this\n  will only happen on write to the console when the cursor is being moved, or\n  when a readable tty is used in raw mode.\n* `'SIGKILL'` cannot have a listener installed, it will unconditionally\n  terminate Node.js on all platforms.\n* `'SIGSTOP'` cannot have a listener installed.\n* `'SIGBUS'`, `'SIGFPE'`, `'SIGSEGV'`, and `'SIGILL'`, when not raised\n  artificially using [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html), inherently leave the process in a state from\n  which it is not safe to call JS listeners. Doing so might cause the process\n  to stop responding.\n* `0` can be sent to test for the existence of a process, it has no effect if\n  the process exists, but will throw an error if the process does not exist.\n\nWindows does not support signals so has no equivalent to termination by signal,\nbut Node.js offers some emulation with [`process.kill()`](#processkillpid-signal), and\n[`subprocess.kill()`](child_process.html#subprocesskillsignal):\n\n* Sending `SIGINT`, `SIGTERM`, and `SIGKILL` will cause the unconditional\n  termination of the target process, and afterwards, subprocess will report that\n  the process was terminated by signal.\n* Sending signal `0` can be used as a platform independent way to test for the\n  existence of a process.","summary":"Signal events will be emitted when the Node.js process receives a signal. Please refer to `signal(7)` for a listing of standard POSIX signal names such as `'SIGINT'`, `'SIGHUP'`, etc.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\n// Begin reading from stdin so the process does not exit.\nprocess.stdin.resume();\n\nprocess.on('SIGINT', () => {\n  console.log('Received SIGINT. Press Control-D to exit.');\n});\n\n// Using a single function to handle multiple signals\nfunction handle(signal) {\n  console.log(`Received ${signal}`);\n}\n\nprocess.on('SIGINT', handle);\nprocess.on('SIGTERM', handle);"},{"language":"cjs","displayName":null,"code":"// Begin reading from stdin so the process does not exit.\nprocess.stdin.resume();\n\nprocess.on('SIGINT', () => {\n  console.log('Received SIGINT. Press Control-D to exit.');\n});\n\n// Using a single function to handle multiple signals\nfunction handle(signal) {\n  console.log(`Received ${signal}`);\n}\n\nprocess.on('SIGINT', handle);\nprocess.on('SIGTERM', handle);"}],"children":[]}]},{"kind":"method","id":"processabort","name":"abort","title":"`process.abort()`","scope":"global","overloadOf":null,"stability":null,"added":["v0.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"The `process.abort()` method causes the Node.js process to exit immediately and\ngenerate a core file.\n\nThis feature is not available in [`Worker`](worker_threads.html#class-worker) threads.","summary":"The `process.abort()` method causes the Node.js process to exit immediately and generate a core file.","examples":[],"children":[]},{"kind":"method","id":"processadduncaughtexceptioncapturecallbackfn","name":"addUncaughtExceptionCaptureCallback","title":"`process.addUncaughtExceptionCaptureCallback(fn)`","scope":"global","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The `process.addUncaughtExceptionCaptureCallback()` function adds a callback\nthat will be invoked when an uncaught exception occurs, receiving the exception\nvalue as its first argument.\n\nUnlike [`process.setUncaughtExceptionCaptureCallback()`](#processsetuncaughtexceptioncapturecallbackfn), this function allows\nmultiple callbacks to be registered and does not conflict with the\n[`domain`](domain.html) module. Callbacks are called in reverse order of registration\n(most recent first). If a callback returns `true`, subsequent callbacks\nand the default uncaught exception handling are skipped.\n\n```mjs\nimport process from 'node:process';\n\nprocess.addUncaughtExceptionCaptureCallback((err) => {\n  console.error('Caught exception:', err.message);\n  return true; // Indicates exception was handled\n});\n```\n\n```cjs\nprocess.addUncaughtExceptionCaptureCallback((err) => {\n  console.error('Caught exception:', err.message);\n  return true; // Indicates exception was handled\n});\n```","summary":"The `process.addUncaughtExceptionCaptureCallback()` function adds a callback that will be invoked when an uncaught exception occurs, receiving the exception value as its first argument.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nprocess.addUncaughtExceptionCaptureCallback((err) => {\n  console.error('Caught exception:', err.message);\n  return true; // Indicates exception was handled\n});"},{"language":"cjs","displayName":null,"code":"process.addUncaughtExceptionCaptureCallback((err) => {\n  console.error('Caught exception:', err.message);\n  return true; // Indicates exception was handled\n});"}],"children":[]},{"kind":"property","id":"processallowednodeenvironmentflags","name":"allowedNodeEnvironmentFlags","title":"`process.allowedNodeEnvironmentFlags`","scope":"global","overloadOf":null,"stability":null,"added":["v10.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Set","links":[{"name":"Set","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set","start":0,"end":3}]},"default":null,"description":"The `process.allowedNodeEnvironmentFlags` property is a special,\nread-only `Set` of flags allowable within the [`NODE_OPTIONS`](cli.html#node_optionsoptions)\nenvironment variable.\n\n`process.allowedNodeEnvironmentFlags` extends `Set`, but overrides\n`Set.prototype.has` to recognize several different possible flag\nrepresentations. `process.allowedNodeEnvironmentFlags.has()` will\nreturn `true` in the following cases:\n\n* Flags may omit leading single (`-`) or double (`--`) dashes; e.g.,\n  `inspect-brk` for `--inspect-brk`, or `r` for `-r`.\n* Flags passed through to V8 (as listed in `--v8-options`) may replace\n  one or more *non-leading* dashes for an underscore, or vice-versa;\n  e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`,\n  etc.\n* Flags may contain one or more equals (`=`) characters; all\n  characters after and including the first equals will be ignored;\n  e.g., `--stack-trace-limit=100`.\n* Flags *must* be allowable within [`NODE_OPTIONS`](cli.html#node_optionsoptions).\n\nWhen iterating over `process.allowedNodeEnvironmentFlags`, flags will\nappear only *once*; each will begin with one or more dashes. Flags\npassed through to V8 will contain underscores instead of non-leading\ndashes:\n\n```mjs\nimport { allowedNodeEnvironmentFlags } from 'node:process';\n\nallowedNodeEnvironmentFlags.forEach((flag) => {\n  // -r\n  // --inspect-brk\n  // --abort_on_uncaught_exception\n  // ...\n});\n```\n\n```cjs\nconst { allowedNodeEnvironmentFlags } = require('node:process');\n\nallowedNodeEnvironmentFlags.forEach((flag) => {\n  // -r\n  // --inspect-brk\n  // --abort_on_uncaught_exception\n  // ...\n});\n```\n\nThe methods `add()`, `clear()`, and `delete()` of\n`process.allowedNodeEnvironmentFlags` do nothing, and will fail\nsilently.\n\nIf Node.js was compiled *without* [`NODE_OPTIONS`](cli.html#node_optionsoptions) support (shown in\n[`process.config`](#processconfig)), `process.allowedNodeEnvironmentFlags` will\ncontain what *would have* been allowable.","summary":"The `process.allowedNodeEnvironmentFlags` property is a special, read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable.","examples":[{"language":"mjs","displayName":null,"code":"import { allowedNodeEnvironmentFlags } from 'node:process';\n\nallowedNodeEnvironmentFlags.forEach((flag) => {\n  // -r\n  // --inspect-brk\n  // --abort_on_uncaught_exception\n  // ...\n});"},{"language":"cjs","displayName":null,"code":"const { allowedNodeEnvironmentFlags } = require('node:process');\n\nallowedNodeEnvironmentFlags.forEach((flag) => {\n  // -r\n  // --inspect-brk\n  // --abort_on_uncaught_exception\n  // ...\n});"}],"children":[]},{"kind":"property","id":"processarch","name":"arch","title":"`process.arch`","scope":"global","overloadOf":null,"stability":null,"added":["v0.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The operating system CPU architecture for which the Node.js binary was compiled.\nPossible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`,\n`'mipsel'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`.\n\n```mjs\nimport { arch } from 'node:process';\n\nconsole.log(`This processor architecture is ${arch}`);\n```\n\n```cjs\nconst { arch } = require('node:process');\n\nconsole.log(`This processor architecture is ${arch}`);\n```","summary":"The operating system CPU architecture for which the Node.js binary was compiled. Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`.","examples":[{"language":"mjs","displayName":null,"code":"import { arch } from 'node:process';\n\nconsole.log(`This processor architecture is ${arch}`);"},{"language":"cjs","displayName":null,"code":"const { arch } = require('node:process');\n\nconsole.log(`This processor architecture is ${arch}`);"}],"children":[]},{"kind":"property","id":"processargv","name":"argv","title":"`process.argv`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.27"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The `process.argv` property returns an array containing the command-line\narguments passed when the Node.js process was launched. The first element will\nbe [`process.execPath`](#processexecpath). See `process.argv0` if access to the original value\nof `argv[0]` is needed. If a [program entry point](https://nodejs.org/api/cli.html#program-entry-point) was provided, the second element\nwill be the absolute path to it. The remaining elements are additional command-line\narguments.\n\nFor example, assuming the following script for `process-args.js`:\n\n```mjs\nimport { argv } from 'node:process';\n\n// print process.argv\nargv.forEach((val, index) => {\n  console.log(`${index}: ${val}`);\n});\n```\n\n```cjs\nconst { argv } = require('node:process');\n\n// print process.argv\nargv.forEach((val, index) => {\n  console.log(`${index}: ${val}`);\n});\n```\n\nLaunching the Node.js process as:\n\n```bash\nnode process-args.js one two=three four\n```\n\nWould generate the output:\n\n```text\n0: /usr/local/bin/node\n1: /Users/mjr/work/node/process-args.js\n2: one\n3: two=three\n4: four\n```","summary":"The `process.argv` property returns an array containing the command-line arguments passed when the Node.js process was launched. The first element will be `process.execPath`. See `process.argv0` if access to the original value of `argv[0]` is needed. If a program entry point was provided, the second element will be the absolute path to it. The remaining elements are additional command-line arguments.","examples":[{"language":"mjs","displayName":null,"code":"import { argv } from 'node:process';\n\n// print process.argv\nargv.forEach((val, index) => {\n  console.log(`${index}: ${val}`);\n});"},{"language":"cjs","displayName":null,"code":"const { argv } = require('node:process');\n\n// print process.argv\nargv.forEach((val, index) => {\n  console.log(`${index}: ${val}`);\n});"},{"language":"bash","displayName":null,"code":"node process-args.js one two=three four"},{"language":"text","displayName":null,"code":"0: /usr/local/bin/node\n1: /Users/mjr/work/node/process-args.js\n2: one\n3: two=three\n4: four"}],"children":[]},{"kind":"property","id":"processargv0","name":"argv0","title":"`process.argv0`","scope":"global","overloadOf":null,"stability":null,"added":["v6.4.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The `process.argv0` property stores a read-only copy of the original value of\n`argv[0]` passed when Node.js starts.\n\n```console\n$ bash -c 'exec -a customArgv0 ./node'\n> process.argv[0]\n'/Volumes/code/external/node/out/Release/node'\n> process.argv0\n'customArgv0'\n```","summary":"The `process.argv0` property stores a read-only copy of the original value of `argv[0]` passed when Node.js starts.","examples":[{"language":"console","displayName":null,"code":"$ bash -c 'exec -a customArgv0 ./node'\n> process.argv[0]\n'/Volumes/code/external/node/out/Release/node'\n> process.argv0\n'customArgv0'"}],"children":[]},{"kind":"method","id":"processavailablememory","name":"availableMemory","title":"`process.availableMemory()`","scope":"global","overloadOf":null,"stability":null,"added":["v22.0.0","v20.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.0.0","v22.16.0"],"prUrl":"https://github.com/nodejs/node/pull/57765","commit":null,"description":"Change stability index for this feature from Experimental to Stable."}],"signature":{"parameters":[],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":""}},"description":"Gets the amount of free memory that is still available to the process\n(in bytes).\n\nSee [`uv_get_available_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_available_memory) for more\ninformation.","summary":"Gets the amount of free memory that is still available to the process (in bytes).","examples":[],"children":[]},{"kind":"property","id":"processchannel","name":"channel","title":"`process.channel`","scope":"global","overloadOf":null,"stability":null,"added":["v7.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v14.0.0"],"prUrl":"https://github.com/nodejs/node/pull/30165","commit":null,"description":"The object no longer accidentally exposes native C++ bindings."}],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"If the Node.js process was spawned with an IPC channel (see the\n[Child Process](child_process.html) documentation), the `process.channel`\nproperty is a reference to the IPC channel. If no IPC channel exists, this\nproperty is `undefined`.","summary":"If the Node.js process was spawned with an IPC channel (see the Child Process documentation), the `process.channel` property is a reference to the IPC channel. If no IPC channel exists, this property is `undefined`.","examples":[],"children":[{"kind":"method","id":"processchannelref","name":"ref","title":"`process.channel.ref()`","scope":"global","overloadOf":null,"stability":null,"added":["v7.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"This method makes the IPC channel keep the event loop of the process\nrunning if `.unref()` has been called before.\n\nTypically, this is managed through the number of `'disconnect'` and `'message'`\nlisteners on the `process` object. However, this method can be used to\nexplicitly request a specific behavior.","summary":"This method makes the IPC channel keep the event loop of the process running if `.unref()` has been called before.","examples":[],"children":[]},{"kind":"method","id":"processchannelunref","name":"unref","title":"`process.channel.unref()`","scope":"global","overloadOf":null,"stability":null,"added":["v7.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"This method makes the IPC channel not keep the event loop of the process\nrunning, and lets it finish even while the channel is open.\n\nTypically, this is managed through the number of `'disconnect'` and `'message'`\nlisteners on the `process` object. However, this method can be used to\nexplicitly request a specific behavior.","summary":"This method makes the IPC channel not keep the event loop of the process running, and lets it finish even while the channel is open.","examples":[],"children":[]}]},{"kind":"method","id":"processchdirdirectory","name":"chdir","title":"`process.chdir(directory)`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.17"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"directory","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The `process.chdir()` method changes the current working directory of the\nNode.js process or throws an exception if doing so fails (for instance, if\nthe specified `directory` does not exist).\n\n```mjs\nimport { chdir, cwd } from 'node:process';\n\nconsole.log(`Starting directory: ${cwd()}`);\ntry {\n  chdir('/tmp');\n  console.log(`New directory: ${cwd()}`);\n} catch (err) {\n  console.error(`chdir: ${err}`);\n}\n```\n\n```cjs\nconst { chdir, cwd } = require('node:process');\n\nconsole.log(`Starting directory: ${cwd()}`);\ntry {\n  chdir('/tmp');\n  console.log(`New directory: ${cwd()}`);\n} catch (err) {\n  console.error(`chdir: ${err}`);\n}\n```\n\nThis feature is not available in [`Worker`](worker_threads.html#class-worker) threads.","summary":"The `process.chdir()` method changes the current working directory of the Node.js process or throws an exception if doing so fails (for instance, if the specified `directory` does not exist).","examples":[{"language":"mjs","displayName":null,"code":"import { chdir, cwd } from 'node:process';\n\nconsole.log(`Starting directory: ${cwd()}`);\ntry {\n  chdir('/tmp');\n  console.log(`New directory: ${cwd()}`);\n} catch (err) {\n  console.error(`chdir: ${err}`);\n}"},{"language":"cjs","displayName":null,"code":"const { chdir, cwd } = require('node:process');\n\nconsole.log(`Starting directory: ${cwd()}`);\ntry {\n  chdir('/tmp');\n  console.log(`New directory: ${cwd()}`);\n} catch (err) {\n  console.error(`chdir: ${err}`);\n}"}],"children":[]},{"kind":"property","id":"processconfig","name":"config","title":"`process.config`","scope":"global","overloadOf":null,"stability":null,"added":["v0.7.7"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/43627","commit":null,"description":"The `process.config` object is now frozen."},{"versions":["v16.0.0"],"prUrl":"https://github.com/nodejs/node/pull/36902","commit":null,"description":"Modifying process.config has been deprecated."}],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"The `process.config` property returns a frozen `Object` containing the\nJavaScript representation of the configure options used to compile the current\nNode.js executable. This is the same as the `config.gypi` file that was produced\nwhen running the `./configure` script.\n\nAn example of the possible output looks like:\n\n```json\n{\n  \"target_defaults\":\n   { \"cflags\": [],\n     \"default_configuration\": \"Release\",\n     \"defines\": [],\n     \"include_dirs\": [],\n     \"libraries\": [] },\n  \"variables\":\n   {\n     \"host_arch\": \"x64\",\n     \"napi_build_version\": 5,\n     \"node_install_npm\": \"true\",\n     \"node_prefix\": \"\",\n     \"node_shared_cares\": \"false\",\n     \"node_shared_http_parser\": \"false\",\n     \"node_shared_libuv\": \"false\",\n     \"node_shared_zlib\": \"false\",\n     \"node_use_openssl\": \"true\",\n     \"node_shared_openssl\": \"false\",\n     \"target_arch\": \"x64\",\n     \"v8_use_snapshot\": 1\n   }\n}\n```","summary":"The `process.config` property returns a frozen `Object` containing the JavaScript representation of the configure options used to compile the current Node.js executable. This is the same as the `config.gypi` file that was produced when running the `./configure` script.","examples":[{"language":"json","displayName":null,"code":"{\n  \"target_defaults\":\n   { \"cflags\": [],\n     \"default_configuration\": \"Release\",\n     \"defines\": [],\n     \"include_dirs\": [],\n     \"libraries\": [] },\n  \"variables\":\n   {\n     \"host_arch\": \"x64\",\n     \"napi_build_version\": 5,\n     \"node_install_npm\": \"true\",\n     \"node_prefix\": \"\",\n     \"node_shared_cares\": \"false\",\n     \"node_shared_http_parser\": \"false\",\n     \"node_shared_libuv\": \"false\",\n     \"node_shared_zlib\": \"false\",\n     \"node_use_openssl\": \"true\",\n     \"node_shared_openssl\": \"false\",\n     \"target_arch\": \"x64\",\n     \"v8_use_snapshot\": 1\n   }\n}"}],"children":[]},{"kind":"property","id":"processconnected","name":"connected","title":"`process.connected`","scope":"global","overloadOf":null,"stability":null,"added":["v0.7.2"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"If the Node.js process is spawned with an IPC channel (see the [Child Process](child_process.html)\nand [Cluster](cluster.html) documentation), the `process.connected` property will return\n`true` so long as the IPC channel is connected and will return `false` after\n`process.disconnect()` is called.\n\nOnce `process.connected` is `false`, it is no longer possible to send messages\nover the IPC channel using `process.send()`.","summary":"If the Node.js process is spawned with an IPC channel (see the Child Process and Cluster documentation), the `process.connected` property will return `true` so long as the IPC channel is connected and will return `false` after `process.disconnect()` is called.","examples":[],"children":[]},{"kind":"method","id":"processconstrainedmemory","name":"constrainedMemory","title":"`process.constrainedMemory()`","scope":"global","overloadOf":null,"stability":null,"added":["v19.6.0","v18.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.0.0","v22.16.0"],"prUrl":"https://github.com/nodejs/node/pull/57765","commit":null,"description":"Change stability index for this feature from Experimental to Stable."},{"versions":["v22.0.0","v20.13.0"],"prUrl":"https://github.com/nodejs/node/pull/52039","commit":null,"description":"Aligned return value with `uv_get_constrained_memory`."}],"signature":{"parameters":[],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":""}},"description":"Gets the amount of memory available to the process (in bytes) based on\nlimits imposed by the OS. If there is no such constraint, or the constraint\nis unknown, `0` is returned.\n\nSee [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more\ninformation.","summary":"Gets the amount of memory available to the process (in bytes) based on limits imposed by the OS. If there is no such constraint, or the constraint is unknown, `0` is returned.","examples":[],"children":[]},{"kind":"method","id":"processcpuusagepreviousvalue","name":"cpuUsage","title":"`process.cpuUsage([previousValue])`","scope":"global","overloadOf":null,"stability":null,"added":["v6.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"previousValue","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"A previous return value from calling\n`process.cpuUsage()`","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"The `process.cpuUsage()` method returns the user and system CPU time usage of\nthe current process, in an object with properties `user` and `system`, whose\nvalues are microsecond values (millionth of a second). These values measure time\nspent in user and system code respectively, and may end up being greater than\nactual elapsed time if multiple CPU cores are performing work for this process.\n\nThe result of a previous call to `process.cpuUsage()` can be passed as the\nargument to the function, to get a diff reading.\n\n```mjs\nimport { cpuUsage } from 'node:process';\n\nconst startUsage = cpuUsage();\n// { user: 38579, system: 6986 }\n\n// spin the CPU for 500 milliseconds\nconst now = Date.now();\nwhile (Date.now() - now < 500);\n\nconsole.log(cpuUsage(startUsage));\n// { user: 514883, system: 11226 }\n```\n\n```cjs\nconst { cpuUsage } = require('node:process');\n\nconst startUsage = cpuUsage();\n// { user: 38579, system: 6986 }\n\n// spin the CPU for 500 milliseconds\nconst now = Date.now();\nwhile (Date.now() - now < 500);\n\nconsole.log(cpuUsage(startUsage));\n// { user: 514883, system: 11226 }\n```","summary":"The `process.cpuUsage()` method returns the user and system CPU time usage of the current process, in an object with properties `user` and `system`, whose values are microsecond values (millionth of a second). These values measure time spent in user and system code respectively, and may end up being greater than actual elapsed time if multiple CPU cores are performing work for this process.","examples":[{"language":"mjs","displayName":null,"code":"import { cpuUsage } from 'node:process';\n\nconst startUsage = cpuUsage();\n// { user: 38579, system: 6986 }\n\n// spin the CPU for 500 milliseconds\nconst now = Date.now();\nwhile (Date.now() - now < 500);\n\nconsole.log(cpuUsage(startUsage));\n// { user: 514883, system: 11226 }"},{"language":"cjs","displayName":null,"code":"const { cpuUsage } = require('node:process');\n\nconst startUsage = cpuUsage();\n// { user: 38579, system: 6986 }\n\n// spin the CPU for 500 milliseconds\nconst now = Date.now();\nwhile (Date.now() - now < 500);\n\nconsole.log(cpuUsage(startUsage));\n// { user: 514883, system: 11226 }"}],"children":[]},{"kind":"method","id":"processcwd","name":"cwd","title":"`process.cwd()`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":""}},"description":"The `process.cwd()` method returns the current working directory of the Node.js\nprocess.\n\n```mjs\nimport { cwd } from 'node:process';\n\nconsole.log(`Current directory: ${cwd()}`);\n```\n\n```cjs\nconst { cwd } = require('node:process');\n\nconsole.log(`Current directory: ${cwd()}`);\n```","summary":"The `process.cwd()` method returns the current working directory of the Node.js process.","examples":[{"language":"mjs","displayName":null,"code":"import { cwd } from 'node:process';\n\nconsole.log(`Current directory: ${cwd()}`);"},{"language":"cjs","displayName":null,"code":"const { cwd } = require('node:process');\n\nconsole.log(`Current directory: ${cwd()}`);"}],"children":[]},{"kind":"property","id":"processdebugport","name":"debugPort","title":"`process.debugPort`","scope":"global","overloadOf":null,"stability":null,"added":["v0.7.2"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The port used by the Node.js debugger when enabled.\n\n```mjs\nimport process from 'node:process';\n\nprocess.debugPort = 5858;\n```\n\n```cjs\nprocess.debugPort = 5858;\n```","summary":"The port used by the Node.js debugger when enabled.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nprocess.debugPort = 5858;"},{"language":"cjs","displayName":null,"code":"process.debugPort = 5858;"}],"children":[]},{"kind":"method","id":"processdisconnect","name":"disconnect","title":"`process.disconnect()`","scope":"global","overloadOf":null,"stability":null,"added":["v0.7.2"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"If the Node.js process is spawned with an IPC channel (see the [Child Process](child_process.html)\nand [Cluster](cluster.html) documentation), the `process.disconnect()` method will close the\nIPC channel to the parent process, allowing the child process to exit gracefully\nonce there are no other connections keeping it alive.\n\nThe effect of calling `process.disconnect()` is the same as calling\n[`ChildProcess.disconnect()`](child_process.html#subprocessdisconnect) from the parent process.\n\nIf the Node.js process was not spawned with an IPC channel,\n`process.disconnect()` will be `undefined`.","summary":"If the Node.js process is spawned with an IPC channel (see the Child Process and Cluster documentation), the `process.disconnect()` method will close the IPC channel to the parent process, allowing the child process to exit gracefully once there are no other connections keeping it alive.","examples":[],"children":[]},{"kind":"method","id":"processdlopenmodule-filename-flags","name":"dlopen","title":"`process.dlopen(module, filename[, flags])`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.16"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12794","commit":null,"description":"Added support for the `flags` argument."}],"signature":{"parameters":[{"name":"module","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"flags","type":{"text":"os.constants.dlopen","links":[{"name":"os.constants.dlopen","href":"os.html#dlopen-constants","start":0,"end":19}]},"description":"","default":"os.constants.dlopen.RTLD_LAZY","optional":true,"rest":false,"properties":[]}],"returns":null},"description":"The `process.dlopen()` method allows dynamically loading shared objects. It is\nprimarily used by `require()` to load C++ Addons, and should not be used\ndirectly, except in special cases. In other words, [`require()`](globals.html#require) should be\npreferred over `process.dlopen()` unless there are specific reasons such as\ncustom dlopen flags or loading from ES modules.\n\nThe `flags` argument is an integer that allows to specify dlopen\nbehavior. See the [`os.constants.dlopen`](os.html#dlopen-constants) documentation for details.\n\nAn important requirement when calling `process.dlopen()` is that the `module`\ninstance must be passed. Functions exported by the C++ Addon are then\naccessible via `module.exports`.\n\nThe example below shows how to load a C++ Addon, named `local.node`,\nthat exports a `foo` function. All the symbols are loaded before\nthe call returns, by passing the `RTLD_NOW` constant. In this example\nthe constant is assumed to be available.\n\n```mjs\nimport { dlopen } from 'node:process';\nimport { constants } from 'node:os';\nimport { fileURLToPath } from 'node:url';\n\nconst module = { exports: {} };\ndlopen(module, fileURLToPath(new URL('local.node', import.meta.url)),\n       constants.dlopen.RTLD_NOW);\nmodule.exports.foo();\n```\n\n```cjs\nconst { dlopen } = require('node:process');\nconst { constants } = require('node:os');\nconst { join } = require('node:path');\n\nconst module = { exports: {} };\ndlopen(module, join(__dirname, 'local.node'), constants.dlopen.RTLD_NOW);\nmodule.exports.foo();\n```","summary":"The `process.dlopen()` method allows dynamically loading shared objects. It is primarily used by `require()` to load C++ Addons, and should not be used directly, except in special cases. In other words, `require()` should be preferred over `process.dlopen()` unless there are specific reasons such as custom dlopen flags or loading from ES modules.","examples":[{"language":"mjs","displayName":null,"code":"import { dlopen } from 'node:process';\nimport { constants } from 'node:os';\nimport { fileURLToPath } from 'node:url';\n\nconst module = { exports: {} };\ndlopen(module, fileURLToPath(new URL('local.node', import.meta.url)),\n       constants.dlopen.RTLD_NOW);\nmodule.exports.foo();"},{"language":"cjs","displayName":null,"code":"const { dlopen } = require('node:process');\nconst { constants } = require('node:os');\nconst { join } = require('node:path');\n\nconst module = { exports: {} };\ndlopen(module, join(__dirname, 'local.node'), constants.dlopen.RTLD_NOW);\nmodule.exports.foo();"}],"children":[]},{"kind":"method","id":"processemitwarningwarning-options","name":"emitWarning","title":"`process.emitWarning(warning[, options])`","scope":"global","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"warning","type":{"text":"string | Error","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14}]},"description":"The warning to emit.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"type","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"When `warning` is a `String`, `type` is the name to use\nfor the *type* of warning being emitted.","default":"'Warning'","optional":true,"rest":false,"properties":[]},{"name":"code","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A unique identifier for the warning instance being emitted.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"ctor","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"When `warning` is a `String`, `ctor` is an optional\nfunction used to limit the generated stack trace.","default":"process.emitWarning","optional":true,"rest":false,"properties":[]},{"name":"detail","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Additional text to include with the error.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"The `process.emitWarning()` method can be used to emit custom or application\nspecific process warnings. These can be listened for by adding a handler to the\n[`'warning'`](#event-warning) event.\n\n```mjs\nimport { emitWarning } from 'node:process';\n\n// Emit a warning with a code and additional detail.\nemitWarning('Something happened!', {\n  code: 'MY_WARNING',\n  detail: 'This is some additional information',\n});\n// Emits:\n// (node:56338) [MY_WARNING] Warning: Something happened!\n// This is some additional information\n```\n\n```cjs\nconst { emitWarning } = require('node:process');\n\n// Emit a warning with a code and additional detail.\nemitWarning('Something happened!', {\n  code: 'MY_WARNING',\n  detail: 'This is some additional information',\n});\n// Emits:\n// (node:56338) [MY_WARNING] Warning: Something happened!\n// This is some additional information\n```\n\nIn this example, an `Error` object is generated internally by\n`process.emitWarning()` and passed through to the\n[`'warning'`](#event-warning) handler.\n\n```mjs\nimport process from 'node:process';\n\nprocess.on('warning', (warning) => {\n  console.warn(warning.name);    // 'Warning'\n  console.warn(warning.message); // 'Something happened!'\n  console.warn(warning.code);    // 'MY_WARNING'\n  console.warn(warning.stack);   // Stack trace\n  console.warn(warning.detail);  // 'This is some additional information'\n});\n```\n\n```cjs\nprocess.on('warning', (warning) => {\n  console.warn(warning.name);    // 'Warning'\n  console.warn(warning.message); // 'Something happened!'\n  console.warn(warning.code);    // 'MY_WARNING'\n  console.warn(warning.stack);   // Stack trace\n  console.warn(warning.detail);  // 'This is some additional information'\n});\n```\n\nIf `warning` is passed as an `Error` object, the `options` argument is ignored.","summary":"The `process.emitWarning()` method can be used to emit custom or application specific process warnings. These can be listened for by adding a handler to the `'warning'` event.","examples":[{"language":"mjs","displayName":null,"code":"import { emitWarning } from 'node:process';\n\n// Emit a warning with a code and additional detail.\nemitWarning('Something happened!', {\n  code: 'MY_WARNING',\n  detail: 'This is some additional information',\n});\n// Emits:\n// (node:56338) [MY_WARNING] Warning: Something happened!\n// This is some additional information"},{"language":"cjs","displayName":null,"code":"const { emitWarning } = require('node:process');\n\n// Emit a warning with a code and additional detail.\nemitWarning('Something happened!', {\n  code: 'MY_WARNING',\n  detail: 'This is some additional information',\n});\n// Emits:\n// (node:56338) [MY_WARNING] Warning: Something happened!\n// This is some additional information"},{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nprocess.on('warning', (warning) => {\n  console.warn(warning.name);    // 'Warning'\n  console.warn(warning.message); // 'Something happened!'\n  console.warn(warning.code);    // 'MY_WARNING'\n  console.warn(warning.stack);   // Stack trace\n  console.warn(warning.detail);  // 'This is some additional information'\n});"},{"language":"cjs","displayName":null,"code":"process.on('warning', (warning) => {\n  console.warn(warning.name);    // 'Warning'\n  console.warn(warning.message); // 'Something happened!'\n  console.warn(warning.code);    // 'MY_WARNING'\n  console.warn(warning.stack);   // Stack trace\n  console.warn(warning.detail);  // 'This is some additional information'\n});"}],"children":[]},{"kind":"method","id":"processemitwarningwarning-type-code-ctor","name":"emitWarning","title":"`process.emitWarning(warning[, type[, code]][, ctor])`","scope":"global","overloadOf":"processemitwarningwarning-options","stability":null,"added":["v6.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"warning","type":{"text":"string | Error","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":9,"end":14}]},"description":"The warning to emit.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"type","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"When `warning` is a `String`, `type` is the name to use\nfor the *type* of warning being emitted.","default":"'Warning'","optional":true,"rest":false,"properties":[]},{"name":"code","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A unique identifier for the warning instance being emitted.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"ctor","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"When `warning` is a `String`, `ctor` is an optional\nfunction used to limit the generated stack trace.","default":"process.emitWarning","optional":true,"rest":false,"properties":[]}],"returns":null},"description":"The `process.emitWarning()` method can be used to emit custom or application\nspecific process warnings. These can be listened for by adding a handler to the\n[`'warning'`](#event-warning) event.\n\n```mjs\nimport { emitWarning } from 'node:process';\n\n// Emit a warning using a string.\nemitWarning('Something happened!');\n// Emits: (node: 56338) Warning: Something happened!\n```\n\n```cjs\nconst { emitWarning } = require('node:process');\n\n// Emit a warning using a string.\nemitWarning('Something happened!');\n// Emits: (node: 56338) Warning: Something happened!\n```\n\n```mjs\nimport { emitWarning } from 'node:process';\n\n// Emit a warning using a string and a type.\nemitWarning('Something Happened!', 'CustomWarning');\n// Emits: (node:56338) CustomWarning: Something Happened!\n```\n\n```cjs\nconst { emitWarning } = require('node:process');\n\n// Emit a warning using a string and a type.\nemitWarning('Something Happened!', 'CustomWarning');\n// Emits: (node:56338) CustomWarning: Something Happened!\n```\n\n```mjs\nimport { emitWarning } from 'node:process';\n\nemitWarning('Something happened!', 'CustomWarning', 'WARN001');\n// Emits: (node:56338) [WARN001] CustomWarning: Something happened!\n```\n\n```cjs\nconst { emitWarning } = require('node:process');\n\nprocess.emitWarning('Something happened!', 'CustomWarning', 'WARN001');\n// Emits: (node:56338) [WARN001] CustomWarning: Something happened!\n```\n\nIn each of the previous examples, an `Error` object is generated internally by\n`process.emitWarning()` and passed through to the [`'warning'`](#event-warning)\nhandler.\n\n```mjs\nimport process from 'node:process';\n\nprocess.on('warning', (warning) => {\n  console.warn(warning.name);\n  console.warn(warning.message);\n  console.warn(warning.code);\n  console.warn(warning.stack);\n});\n```\n\n```cjs\nprocess.on('warning', (warning) => {\n  console.warn(warning.name);\n  console.warn(warning.message);\n  console.warn(warning.code);\n  console.warn(warning.stack);\n});\n```\n\nIf `warning` is passed as an `Error` object, it will be passed through to the\n`'warning'` event handler unmodified (and the optional `type`,\n`code` and `ctor` arguments will be ignored):\n\n```mjs\nimport { emitWarning } from 'node:process';\n\n// Emit a warning using an Error object.\nconst myWarning = new Error('Something happened!');\n// Use the Error name property to specify the type name\nmyWarning.name = 'CustomWarning';\nmyWarning.code = 'WARN001';\n\nemitWarning(myWarning);\n// Emits: (node:56338) [WARN001] CustomWarning: Something happened!\n```\n\n```cjs\nconst { emitWarning } = require('node:process');\n\n// Emit a warning using an Error object.\nconst myWarning = new Error('Something happened!');\n// Use the Error name property to specify the type name\nmyWarning.name = 'CustomWarning';\nmyWarning.code = 'WARN001';\n\nemitWarning(myWarning);\n// Emits: (node:56338) [WARN001] CustomWarning: Something happened!\n```\n\nA `TypeError` is thrown if `warning` is anything other than a string or `Error`\nobject.\n\nWhile process warnings use `Error` objects, the process warning\nmechanism is **not** a replacement for normal error handling mechanisms.\n\nThe following additional handling is implemented if the warning `type` is\n`'DeprecationWarning'`:\n\n* If the `--throw-deprecation` command-line flag is used, the deprecation\n  warning is thrown as an exception rather than being emitted as an event.\n* If the `--no-deprecation` command-line flag is used, the deprecation\n  warning is suppressed.\n* If the `--trace-deprecation` command-line flag is used, the deprecation\n  warning is printed to `stderr` along with the full stack trace.","summary":"The `process.emitWarning()` method can be used to emit custom or application specific process warnings. These can be listened for by adding a handler to the `'warning'` event.","examples":[{"language":"mjs","displayName":null,"code":"import { emitWarning } from 'node:process';\n\n// Emit a warning using a string.\nemitWarning('Something happened!');\n// Emits: (node: 56338) Warning: Something happened!"},{"language":"cjs","displayName":null,"code":"const { emitWarning } = require('node:process');\n\n// Emit a warning using a string.\nemitWarning('Something happened!');\n// Emits: (node: 56338) Warning: Something happened!"},{"language":"mjs","displayName":null,"code":"import { emitWarning } from 'node:process';\n\n// Emit a warning using a string and a type.\nemitWarning('Something Happened!', 'CustomWarning');\n// Emits: (node:56338) CustomWarning: Something Happened!"},{"language":"cjs","displayName":null,"code":"const { emitWarning } = require('node:process');\n\n// Emit a warning using a string and a type.\nemitWarning('Something Happened!', 'CustomWarning');\n// Emits: (node:56338) CustomWarning: Something Happened!"},{"language":"mjs","displayName":null,"code":"import { emitWarning } from 'node:process';\n\nemitWarning('Something happened!', 'CustomWarning', 'WARN001');\n// Emits: (node:56338) [WARN001] CustomWarning: Something happened!"},{"language":"cjs","displayName":null,"code":"const { emitWarning } = require('node:process');\n\nprocess.emitWarning('Something happened!', 'CustomWarning', 'WARN001');\n// Emits: (node:56338) [WARN001] CustomWarning: Something happened!"},{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nprocess.on('warning', (warning) => {\n  console.warn(warning.name);\n  console.warn(warning.message);\n  console.warn(warning.code);\n  console.warn(warning.stack);\n});"},{"language":"cjs","displayName":null,"code":"process.on('warning', (warning) => {\n  console.warn(warning.name);\n  console.warn(warning.message);\n  console.warn(warning.code);\n  console.warn(warning.stack);\n});"},{"language":"mjs","displayName":null,"code":"import { emitWarning } from 'node:process';\n\n// Emit a warning using an Error object.\nconst myWarning = new Error('Something happened!');\n// Use the Error name property to specify the type name\nmyWarning.name = 'CustomWarning';\nmyWarning.code = 'WARN001';\n\nemitWarning(myWarning);\n// Emits: (node:56338) [WARN001] CustomWarning: Something happened!"},{"language":"cjs","displayName":null,"code":"const { emitWarning } = require('node:process');\n\n// Emit a warning using an Error object.\nconst myWarning = new Error('Something happened!');\n// Use the Error name property to specify the type name\nmyWarning.name = 'CustomWarning';\nmyWarning.code = 'WARN001';\n\nemitWarning(myWarning);\n// Emits: (node:56338) [WARN001] CustomWarning: Something happened!"}],"children":[{"kind":"section","id":"avoiding-duplicate-warnings","name":"Avoiding duplicate warnings","title":"Avoiding duplicate warnings","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"As a best practice, warnings should be emitted only once per process. To do\nso, place the `emitWarning()` behind a boolean.\n\n```mjs\nimport { emitWarning } from 'node:process';\n\nfunction emitMyWarning() {\n  if (!emitMyWarning.warned) {\n    emitMyWarning.warned = true;\n    emitWarning('Only warn once!');\n  }\n}\nemitMyWarning();\n// Emits: (node: 56339) Warning: Only warn once!\nemitMyWarning();\n// Emits nothing\n```\n\n```cjs\nconst { emitWarning } = require('node:process');\n\nfunction emitMyWarning() {\n  if (!emitMyWarning.warned) {\n    emitMyWarning.warned = true;\n    emitWarning('Only warn once!');\n  }\n}\nemitMyWarning();\n// Emits: (node: 56339) Warning: Only warn once!\nemitMyWarning();\n// Emits nothing\n```","summary":"As a best practice, warnings should be emitted only once per process. To do so, place the `emitWarning()` behind a boolean.","examples":[{"language":"mjs","displayName":null,"code":"import { emitWarning } from 'node:process';\n\nfunction emitMyWarning() {\n  if (!emitMyWarning.warned) {\n    emitMyWarning.warned = true;\n    emitWarning('Only warn once!');\n  }\n}\nemitMyWarning();\n// Emits: (node: 56339) Warning: Only warn once!\nemitMyWarning();\n// Emits nothing"},{"language":"cjs","displayName":null,"code":"const { emitWarning } = require('node:process');\n\nfunction emitMyWarning() {\n  if (!emitMyWarning.warned) {\n    emitMyWarning.warned = true;\n    emitWarning('Only warn once!');\n  }\n}\nemitMyWarning();\n// Emits: (node: 56339) Warning: Only warn once!\nemitMyWarning();\n// Emits nothing"}],"children":[]}]},{"kind":"property","id":"processenv","name":"env","title":"`process.env`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.27"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v11.14.0"],"prUrl":"https://github.com/nodejs/node/pull/26544","commit":null,"description":"Worker threads will now use a copy of the parent thread's `process.env` by default, configurable through the `env` option of the `Worker` constructor."},{"versions":["v10.0.0"],"prUrl":"https://github.com/nodejs/node/pull/18990","commit":null,"description":"Implicit conversion of variable value to string is deprecated."}],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"The `process.env` property returns an object containing the user environment.\nSee [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html).\n\nAn example of this object looks like:\n\n```json\n{\n  \"TERM\": \"xterm-256color\",\n  \"SHELL\": \"/usr/local/bin/bash\",\n  \"USER\": \"maciej\",\n  \"PATH\": \"~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin\",\n  \"PWD\": \"/Users/maciej\",\n  \"EDITOR\": \"vim\",\n  \"SHLVL\": \"1\",\n  \"HOME\": \"/Users/maciej\",\n  \"LOGNAME\": \"maciej\",\n  \"_\": \"/usr/local/bin/node\"\n}\n```\n\nIt is possible to modify this object, but such modifications will not be\nreflected outside the Node.js process, or (unless explicitly requested)\nto other [`Worker`](worker_threads.html#class-worker) threads.\nIn other words, the following example would not work:\n\n```bash\nnode -e 'process.env.foo = \"bar\"' && echo $foo\n```\n\nWhile the following will:\n\n```mjs\nimport { env } from 'node:process';\n\nenv.foo = 'bar';\nconsole.log(env.foo);\n```\n\n```cjs\nconst { env } = require('node:process');\n\nenv.foo = 'bar';\nconsole.log(env.foo);\n```\n\nAssigning a property on `process.env` will implicitly convert the value\nto a string. **This behavior is deprecated.** Future versions of Node.js may\nthrow an error when the value is not a string, number, or boolean.\n\n```mjs\nimport { env } from 'node:process';\n\nenv.test = null;\nconsole.log(env.test);\n// => 'null'\nenv.test = undefined;\nconsole.log(env.test);\n// => 'undefined'\n```\n\n```cjs\nconst { env } = require('node:process');\n\nenv.test = null;\nconsole.log(env.test);\n// => 'null'\nenv.test = undefined;\nconsole.log(env.test);\n// => 'undefined'\n```\n\nUse `delete` to delete a property from `process.env`.\n\n```mjs\nimport { env } from 'node:process';\n\nenv.TEST = 1;\ndelete env.TEST;\nconsole.log(env.TEST);\n// => undefined\n```\n\n```cjs\nconst { env } = require('node:process');\n\nenv.TEST = 1;\ndelete env.TEST;\nconsole.log(env.TEST);\n// => undefined\n```\n\nOn Windows operating systems, environment variables are case-insensitive.\n\n```mjs\nimport { env } from 'node:process';\n\nenv.TEST = 1;\nconsole.log(env.test);\n// => 1\n```\n\n```cjs\nconst { env } = require('node:process');\n\nenv.TEST = 1;\nconsole.log(env.test);\n// => 1\n```\n\nUnless explicitly specified when creating a [`Worker`](worker_threads.html#class-worker) instance,\neach [`Worker`](worker_threads.html#class-worker) thread has its own copy of `process.env`, based on its\nparent thread's `process.env`, or whatever was specified as the `env` option\nto the [`Worker`](worker_threads.html#class-worker) constructor. Changes to `process.env` will not be visible\nacross [`Worker`](worker_threads.html#class-worker) threads, and only the main thread can make changes that\nare visible to the operating system or to native add-ons. On Windows, a copy of\n`process.env` on a [`Worker`](worker_threads.html#class-worker) instance operates in a case-sensitive manner\nunlike the main thread.","summary":"The `process.env` property returns an object containing the user environment. See `environ(7)`.","examples":[{"language":"json","displayName":null,"code":"{\n  \"TERM\": \"xterm-256color\",\n  \"SHELL\": \"/usr/local/bin/bash\",\n  \"USER\": \"maciej\",\n  \"PATH\": \"~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin\",\n  \"PWD\": \"/Users/maciej\",\n  \"EDITOR\": \"vim\",\n  \"SHLVL\": \"1\",\n  \"HOME\": \"/Users/maciej\",\n  \"LOGNAME\": \"maciej\",\n  \"_\": \"/usr/local/bin/node\"\n}"},{"language":"bash","displayName":null,"code":"node -e 'process.env.foo = \"bar\"' && echo $foo"},{"language":"mjs","displayName":null,"code":"import { env } from 'node:process';\n\nenv.foo = 'bar';\nconsole.log(env.foo);"},{"language":"cjs","displayName":null,"code":"const { env } = require('node:process');\n\nenv.foo = 'bar';\nconsole.log(env.foo);"},{"language":"mjs","displayName":null,"code":"import { env } from 'node:process';\n\nenv.test = null;\nconsole.log(env.test);\n// => 'null'\nenv.test = undefined;\nconsole.log(env.test);\n// => 'undefined'"},{"language":"cjs","displayName":null,"code":"const { env } = require('node:process');\n\nenv.test = null;\nconsole.log(env.test);\n// => 'null'\nenv.test = undefined;\nconsole.log(env.test);\n// => 'undefined'"},{"language":"mjs","displayName":null,"code":"import { env } from 'node:process';\n\nenv.TEST = 1;\ndelete env.TEST;\nconsole.log(env.TEST);\n// => undefined"},{"language":"cjs","displayName":null,"code":"const { env } = require('node:process');\n\nenv.TEST = 1;\ndelete env.TEST;\nconsole.log(env.TEST);\n// => undefined"},{"language":"mjs","displayName":null,"code":"import { env } from 'node:process';\n\nenv.TEST = 1;\nconsole.log(env.test);\n// => 1"},{"language":"cjs","displayName":null,"code":"const { env } = require('node:process');\n\nenv.TEST = 1;\nconsole.log(env.test);\n// => 1"}],"children":[]},{"kind":"property","id":"processexecargv","name":"execArgv","title":"`process.execArgv`","scope":"global","overloadOf":null,"stability":null,"added":["v0.7.7"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The `process.execArgv` property returns the set of Node.js-specific command-line\noptions passed when the Node.js process was launched. These options do not\nappear in the array returned by the [`process.argv`](#processargv) property, and do not\ninclude the Node.js executable, the name of the script, or any options following\nthe script name. These options are useful in order to spawn child processes with\nthe same execution environment as the parent.\n\n```bash\nnode --icu-data-dir=./foo --require ./bar.js script.js --version\n```\n\nResults in `process.execArgv`:\n\n```json\n[\"--icu-data-dir=./foo\", \"--require\", \"./bar.js\"]\n```\n\nAnd `process.argv`:\n\n```json\n[\"/usr/local/bin/node\", \"script.js\", \"--version\"]\n```\n\nRefer to [`Worker` constructor](worker_threads.html#new-workerfilename-options) for the detailed behavior of worker\nthreads with this property.","summary":"The `process.execArgv` property returns the set of Node.js-specific command-line options passed when the Node.js process was launched. These options do not appear in the array returned by the `process.argv` property, and do not include the Node.js executable, the name of the script, or any options following the script name. These options are useful in order to spawn child processes with the same execution environment as the parent.","examples":[{"language":"bash","displayName":null,"code":"node --icu-data-dir=./foo --require ./bar.js script.js --version"},{"language":"json","displayName":null,"code":"[\"--icu-data-dir=./foo\", \"--require\", \"./bar.js\"]"},{"language":"json","displayName":null,"code":"[\"/usr/local/bin/node\", \"script.js\", \"--version\"]"}],"children":[]},{"kind":"property","id":"processexecpath","name":"execPath","title":"`process.execPath`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.100"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The `process.execPath` property returns the absolute pathname of the executable\nthat started the Node.js process. Symbolic links, if any, are resolved.\n\n```json\n\"/usr/local/bin/node\"\n```","summary":"The `process.execPath` property returns the absolute pathname of the executable that started the Node.js process. Symbolic links, if any, are resolved.","examples":[{"language":"json","displayName":null,"code":"\"/usr/local/bin/node\""}],"children":[]},{"kind":"method","id":"processexecvefile-args-env","name":"execve","title":"`process.execve(file[, args[, env]])`","scope":"global","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.11.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.1.0"],"prUrl":"https://github.com/nodejs/node/pull/62878","commit":null,"description":"A failed `execve(2)` system call now throws an exception instead of aborting the process. Native `AtExit` callbacks registered via the embedder API are no longer invoked before the `execve(2)` call."}],"signature":{"parameters":[{"name":"file","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The name or path of the executable file to run.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"args","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"List of string arguments. No argument can contain a null-byte (`\\u0000`).","default":null,"optional":true,"rest":false,"properties":[]},{"name":"env","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Environment key-value pairs.\nNo key or value can contain a null-byte (`\\u0000`).","default":"process.env","optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Replaces the current process with a new process.\n\nThis is achieved by using the `execve` POSIX function and therefore no memory or other\nresources from the current process are preserved, except for the standard input,\nstandard output and standard error file descriptor.\n\nOn success, all other resources are discarded by the system when the\nprocesses are swapped, without triggering any exit or close events, without\nrunning any JavaScript cleanup handler (for example `process.on('exit')`),\nand without invoking native `AtExit` callbacks registered through the\nembedder API. Callers that need to run cleanup logic should do so before\ncalling `process.execve()`.\n\nThis function does not return on success. If the underlying `execve(2)`\nsystem call fails, an `Error` is thrown whose `code` property is set to the\ncorresponding `errno` string (for example, `'ENOENT'` when `file` does not\nexist), with `syscall` set to `'execve'` and `path` set to `file`. When\n`execve(2)` fails the current process continues to run with its state\nunchanged, so a caller may handle the error and take another action.\n\nThis function is not available on Windows or IBM i.","summary":"Replaces the current process with a new process.","examples":[],"children":[]},{"kind":"method","id":"processexitcode","name":"exit","title":"`process.exit([code])`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.13"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v20.0.0"],"prUrl":"https://github.com/nodejs/node/pull/43716","commit":null,"description":"Only accepts a code of type number, or of type string if it represents an integer."}],"signature":{"parameters":[{"name":"code","type":{"text":"integer | string | null | undefined","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":10,"end":16},{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":19,"end":23},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":26,"end":35}]},"description":"The exit code. For string type, only\ninteger strings (e.g.,'1') are allowed.","default":"0","optional":true,"rest":false,"properties":[]}],"returns":null},"description":"The `process.exit()` method instructs Node.js to terminate the process\nsynchronously with an exit status of `code`. If `code` is omitted, exit uses\neither the 'success' code `0` or the value of `process.exitCode` if it has been\nset. Node.js will not terminate until all the [`'exit'`](#event-exit) event listeners are\ncalled.\n\nTo exit with a 'failure' code:\n\n```mjs\nimport { exit } from 'node:process';\n\nexit(1);\n```\n\n```cjs\nconst { exit } = require('node:process');\n\nexit(1);\n```\n\nThe shell that executed Node.js should see the exit code as `1`.\n\nCalling `process.exit()` will force the process to exit as quickly as possible\neven if there are still asynchronous operations pending that have not yet\ncompleted fully, including I/O operations to `process.stdout` and\n`process.stderr`.\n\nIn most situations, it is not actually necessary to call `process.exit()`\nexplicitly. The Node.js process will exit on its own *if there is no additional\nwork pending* in the event loop. The `process.exitCode` property can be set to\ntell the process which exit code to use when the process exits gracefully.\n\nFor instance, the following example illustrates a *misuse* of the\n`process.exit()` method that could lead to data printed to stdout being\ntruncated and lost:\n\n```mjs\nimport { exit } from 'node:process';\n\n// This is an example of what *not* to do:\nif (someConditionNotMet()) {\n  printUsageToStdout();\n  exit(1);\n}\n```\n\n```cjs\nconst { exit } = require('node:process');\n\n// This is an example of what *not* to do:\nif (someConditionNotMet()) {\n  printUsageToStdout();\n  exit(1);\n}\n```\n\nThe reason this is problematic is because writes to `process.stdout` in Node.js\nare sometimes *asynchronous* and may occur over multiple ticks of the Node.js\nevent loop. Calling `process.exit()`, however, forces the process to exit\n*before* those additional writes to `stdout` can be performed.\n\nRather than calling `process.exit()` directly, the code *should* set the\n`process.exitCode` and allow the process to exit naturally by avoiding\nscheduling any additional work for the event loop:\n\n```mjs\nimport process from 'node:process';\n\n// How to properly set the exit code while letting\n// the process exit gracefully.\nif (someConditionNotMet()) {\n  printUsageToStdout();\n  process.exitCode = 1;\n}\n```\n\n```cjs\n// How to properly set the exit code while letting\n// the process exit gracefully.\nif (someConditionNotMet()) {\n  printUsageToStdout();\n  process.exitCode = 1;\n}\n```\n\nIf it is necessary to terminate the Node.js process due to an error condition,\nthrowing an *uncaught* error and allowing the process to terminate accordingly\nis safer than calling `process.exit()`.\n\nIn [`Worker`](worker_threads.html#class-worker) threads, this function stops the current thread rather\nthan the current process.","summary":"The `process.exit()` method instructs Node.js to terminate the process synchronously with an exit status of `code`. If `code` is omitted, exit uses either the 'success' code `0` or the value of `process.exitCode` if it has been set. Node.js will not terminate until all the `'exit'` event listeners are called.","examples":[{"language":"mjs","displayName":null,"code":"import { exit } from 'node:process';\n\nexit(1);"},{"language":"cjs","displayName":null,"code":"const { exit } = require('node:process');\n\nexit(1);"},{"language":"mjs","displayName":null,"code":"import { exit } from 'node:process';\n\n// This is an example of what *not* to do:\nif (someConditionNotMet()) {\n  printUsageToStdout();\n  exit(1);\n}"},{"language":"cjs","displayName":null,"code":"const { exit } = require('node:process');\n\n// This is an example of what *not* to do:\nif (someConditionNotMet()) {\n  printUsageToStdout();\n  exit(1);\n}"},{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\n// How to properly set the exit code while letting\n// the process exit gracefully.\nif (someConditionNotMet()) {\n  printUsageToStdout();\n  process.exitCode = 1;\n}"},{"language":"cjs","displayName":null,"code":"// How to properly set the exit code while letting\n// the process exit gracefully.\nif (someConditionNotMet()) {\n  printUsageToStdout();\n  process.exitCode = 1;\n}"}],"children":[]},{"kind":"property","id":"processexitcode-1","name":"exitCode","title":"`process.exitCode`","scope":"global","overloadOf":null,"stability":null,"added":["v0.11.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v20.0.0"],"prUrl":"https://github.com/nodejs/node/pull/43716","commit":null,"description":"Only accepts a code of type number, or of type string if it represents an integer."}],"type":{"text":"integer | string | null | undefined","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":10,"end":16},{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":19,"end":23},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":26,"end":35}]},"default":"undefined","description":"The exit code. For string type, only\ninteger strings (e.g.,'1') are allowed.\n\nA number which will be the process exit code, when the process either\nexits gracefully, or is exited via [`process.exit()`](#processexitcode) without specifying\na code.\n\nThe value of `process.exitCode` can be updated by either assigning a value to\n`process.exitCode` or by passing an argument to [`process.exit()`](#processexitcode):\n\n```console\n$ node -e 'process.exitCode = 9'; echo $?\n9\n$ node -e 'process.exit(42)'; echo $?\n42\n$ node -e 'process.exitCode = 9; process.exit(42)'; echo $?\n42\n```\n\nThe value can also be set implicitly by Node.js when unrecoverable errors occur (e.g.\nsuch as the encountering of an unsettled top-level await). However explicit\nmanipulations of the exit code always take precedence over implicit ones:\n\n```console\n$ node --input-type=module -e 'await new Promise(() => {})'; echo $?\n13\n$ node --input-type=module -e 'process.exitCode = 9; await new Promise(() => {})'; echo $?\n9\n```","summary":"A number which will be the process exit code, when the process either exits gracefully, or is exited via `process.exit()` without specifying a code.","examples":[{"language":"console","displayName":null,"code":"$ node -e 'process.exitCode = 9'; echo $?\n9\n$ node -e 'process.exit(42)'; echo $?\n42\n$ node -e 'process.exitCode = 9; process.exit(42)'; echo $?\n42"},{"language":"console","displayName":null,"code":"$ node --input-type=module -e 'await new Promise(() => {})'; echo $?\n13\n$ node --input-type=module -e 'process.exitCode = 9; await new Promise(() => {})'; echo $?\n9"}],"children":[]},{"kind":"property","id":"processfeaturescached_builtins","name":"cached_builtins","title":"`process.features.cached_builtins`","scope":"global","overloadOf":null,"stability":null,"added":["v12.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"A boolean value that is `true` if the current Node.js build is caching builtin modules.","summary":"A boolean value that is `true` if the current Node.js build is caching builtin modules.","examples":[],"children":[]},{"kind":"property","id":"processfeaturesdebug","name":"debug","title":"`process.features.debug`","scope":"global","overloadOf":null,"stability":null,"added":["v0.5.5"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"A boolean value that is `true` if the current Node.js build is a debug build.","summary":"A boolean value that is `true` if the current Node.js build is a debug build.","examples":[],"children":[]},{"kind":"property","id":"processfeaturesinspector","name":"inspector","title":"`process.features.inspector`","scope":"global","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"A boolean value that is `true` if the current Node.js build includes the inspector.","summary":"A boolean value that is `true` if the current Node.js build includes the inspector.","examples":[],"children":[]},{"kind":"property","id":"processfeaturesipv6","name":"ipv6","title":"`process.features.ipv6`","scope":"global","overloadOf":null,"stability":{"index":"0","description":"Deprecated. This property is always true, and any checks based on it are\nredundant."},"added":["v0.5.3"],"deprecated":["v23.4.0","v22.13.0"],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"A boolean value that is `true` if the current Node.js build includes support for IPv6.\n\nSince all Node.js builds have IPv6 support, this value is always `true`.","summary":"A boolean value that is `true` if the current Node.js build includes support for IPv6.","examples":[],"children":[]},{"kind":"property","id":"processfeaturesrequire_module","name":"require_module","title":"`process.features.require_module`","scope":"global","overloadOf":null,"stability":null,"added":["v23.0.0","v22.10.0","v20.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"A boolean value that is `true` if the current Node.js build supports\n[loading ECMAScript modules using `require()`](modules.html#loading-ecmascript-modules-using-require).","summary":"A boolean value that is `true` if the current Node.js build supports loading ECMAScript modules using `require()`.","examples":[],"children":[]},{"kind":"property","id":"processfeaturestls","name":"tls","title":"`process.features.tls`","scope":"global","overloadOf":null,"stability":null,"added":["v0.5.3"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"A boolean value that is `true` if the current Node.js build includes support for TLS.","summary":"A boolean value that is `true` if the current Node.js build includes support for TLS.","examples":[],"children":[]},{"kind":"property","id":"processfeaturestls_alpn","name":"tls_alpn","title":"`process.features.tls_alpn`","scope":"global","overloadOf":null,"stability":{"index":"0","description":"Deprecated. Use `process.features.tls` instead."},"added":["v4.8.0"],"deprecated":["v23.4.0","v22.13.0"],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"A boolean value that is `true` if the current Node.js build includes support for ALPN in TLS.\n\nIn Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional ALPN support.\nThis value is therefore identical to that of `process.features.tls`.","summary":"A boolean value that is `true` if the current Node.js build includes support for ALPN in TLS.","examples":[],"children":[]},{"kind":"property","id":"processfeaturestls_ocsp","name":"tls_ocsp","title":"`process.features.tls_ocsp`","scope":"global","overloadOf":null,"stability":{"index":"0","description":"Deprecated. Use `process.features.tls` instead."},"added":["v0.11.13"],"deprecated":["v23.4.0","v22.13.0"],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"A boolean value that is `true` if the current Node.js build includes support for OCSP in TLS.\n\nIn Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional OCSP support.\nThis value is therefore identical to that of `process.features.tls`.","summary":"A boolean value that is `true` if the current Node.js build includes support for OCSP in TLS.","examples":[],"children":[]},{"kind":"property","id":"processfeaturestls_sni","name":"tls_sni","title":"`process.features.tls_sni`","scope":"global","overloadOf":null,"stability":{"index":"0","description":"Deprecated. Use `process.features.tls` instead."},"added":["v0.5.3"],"deprecated":["v23.4.0","v22.13.0"],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"A boolean value that is `true` if the current Node.js build includes support for SNI in TLS.\n\nIn Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional SNI support.\nThis value is therefore identical to that of `process.features.tls`.","summary":"A boolean value that is `true` if the current Node.js build includes support for SNI in TLS.","examples":[],"children":[]},{"kind":"property","id":"processfeaturestypescript","name":"typescript","title":"`process.features.typescript`","scope":"global","overloadOf":null,"stability":{"index":"1.2","description":"Release candidate"},"added":["v23.0.0","v22.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.0.0"],"prUrl":"https://github.com/nodejs/node/pull/61803","commit":null,"description":"Removed `transform` value."},{"versions":["v25.2.0","v24.12.0"],"prUrl":"https://github.com/nodejs/node/pull/60600","commit":null,"description":"Type stripping is now stable."}],"type":{"text":"boolean | string","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":10,"end":16}]},"default":null,"description":"A value that is `\"strip\"` by default, and `false` if\nNode.js is run with `--no-strip-types`.","summary":"A value that is `\"strip\"` by default, and `false` if Node.js is run with `--no-strip-types`.","examples":[],"children":[]},{"kind":"property","id":"processfeaturesuv","name":"uv","title":"`process.features.uv`","scope":"global","overloadOf":null,"stability":{"index":"0","description":"Deprecated. This property is always true, and any checks based on it are\nredundant."},"added":["v0.5.3"],"deprecated":["v23.4.0","v22.13.0"],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"A boolean value that is `true` if the current Node.js build includes support for libuv.\n\nSince it's not possible to build Node.js without libuv, this value is always `true`.","summary":"A boolean value that is `true` if the current Node.js build includes support for libuv.","examples":[],"children":[]},{"kind":"method","id":"processfinalizationregisterref-callback","name":"register","title":"`process.finalization.register(ref, callback)`","scope":"global","overloadOf":null,"stability":{"index":"1.1","description":"Active Development"},"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"ref","type":{"text":"Object | Function","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":9,"end":17}]},"description":"The reference to the resource that is being tracked.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The callback function to be called when the resource\nis finalized.","default":null,"optional":false,"rest":false,"properties":[{"name":"ref","type":{"text":"Object | Function","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":9,"end":17}]},"description":"The reference to the resource that is being tracked.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"event","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The event that triggered the finalization. Defaults to 'exit'.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"This function registers a callback to be called when the process emits the `exit`\nevent if the `ref` object was not garbage collected. If the object `ref` was garbage collected\nbefore the `exit` event is emitted, the callback will be removed from the finalization registry,\nand it will not be called on process exit.\n\nInside the callback you can release the resources allocated by the `ref` object.\nBe aware that all limitations applied to the `beforeExit` event are also applied to the `callback` function,\nthis means that there is a possibility that the callback will not be called under special circumstances.\n\nThe idea of ​​this function is to help you free up resources when the starts process exiting,\nbut also let the object be garbage collected if it is no longer being used.\n\nEg: you can register an object that contains a buffer, you want to make sure that buffer is released\nwhen the process exit, but if the object is garbage collected before the process exit, we no longer\nneed to release the buffer, so in this case we just remove the callback from the finalization registry.\n\n```cjs\nconst { finalization } = require('node:process');\n\n// Please make sure that the function passed to finalization.register()\n// does not create a closure around unnecessary objects.\nfunction onFinalize(obj, event) {\n  // You can do whatever you want with the object\n  obj.dispose();\n}\n\nfunction setup() {\n  // This object can be safely garbage collected,\n  // and the resulting shutdown function will not be called.\n  // There are no leaks.\n  const myDisposableObject = {\n    dispose() {\n      // Free your resources synchronously\n    },\n  };\n\n  finalization.register(myDisposableObject, onFinalize);\n}\n\nsetup();\n```\n\n```mjs\nimport { finalization } from 'node:process';\n\n// Please make sure that the function passed to finalization.register()\n// does not create a closure around unnecessary objects.\nfunction onFinalize(obj, event) {\n  // You can do whatever you want with the object\n  obj.dispose();\n}\n\nfunction setup() {\n  // This object can be safely garbage collected,\n  // and the resulting shutdown function will not be called.\n  // There are no leaks.\n  const myDisposableObject = {\n    dispose() {\n      // Free your resources synchronously\n    },\n  };\n\n  finalization.register(myDisposableObject, onFinalize);\n}\n\nsetup();\n```\n\nThe code above relies on the following assumptions:\n\n* arrow functions are avoided\n* regular functions are recommended to be within the global context (root)\n\nRegular functions *could* reference the context where the `obj` lives, making the `obj` not garbage collectible.\n\nArrow functions will hold the previous context. Consider, for example:\n\n```js\nclass Test {\n  constructor() {\n    finalization.register(this, (ref) => ref.dispose());\n\n    // Even something like this is highly discouraged\n    // finalization.register(this, () => this.dispose());\n  }\n  dispose() {}\n}\n```\n\nIt is very unlikely (not impossible) that this object will be garbage collected,\nbut if it is not, `dispose` will be called when `process.exit` is called.\n\nBe careful and avoid relying on this feature for the disposal of critical resources,\nas it is not guaranteed that the callback will be called under all circumstances.","summary":"This function registers a callback to be called when the process emits the `exit` event if the `ref` object was not garbage collected. If the object `ref` was garbage collected before the `exit` event is emitted, the callback will be removed from the finalization registry, and it will not be called on process exit.","examples":[{"language":"cjs","displayName":null,"code":"const { finalization } = require('node:process');\n\n// Please make sure that the function passed to finalization.register()\n// does not create a closure around unnecessary objects.\nfunction onFinalize(obj, event) {\n  // You can do whatever you want with the object\n  obj.dispose();\n}\n\nfunction setup() {\n  // This object can be safely garbage collected,\n  // and the resulting shutdown function will not be called.\n  // There are no leaks.\n  const myDisposableObject = {\n    dispose() {\n      // Free your resources synchronously\n    },\n  };\n\n  finalization.register(myDisposableObject, onFinalize);\n}\n\nsetup();"},{"language":"mjs","displayName":null,"code":"import { finalization } from 'node:process';\n\n// Please make sure that the function passed to finalization.register()\n// does not create a closure around unnecessary objects.\nfunction onFinalize(obj, event) {\n  // You can do whatever you want with the object\n  obj.dispose();\n}\n\nfunction setup() {\n  // This object can be safely garbage collected,\n  // and the resulting shutdown function will not be called.\n  // There are no leaks.\n  const myDisposableObject = {\n    dispose() {\n      // Free your resources synchronously\n    },\n  };\n\n  finalization.register(myDisposableObject, onFinalize);\n}\n\nsetup();"},{"language":"js","displayName":null,"code":"class Test {\n  constructor() {\n    finalization.register(this, (ref) => ref.dispose());\n\n    // Even something like this is highly discouraged\n    // finalization.register(this, () => this.dispose());\n  }\n  dispose() {}\n}"}],"children":[]},{"kind":"method","id":"processfinalizationregisterbeforeexitref-callback","name":"registerBeforeExit","title":"`process.finalization.registerBeforeExit(ref, callback)`","scope":"global","overloadOf":null,"stability":{"index":"1.1","description":"Active Development"},"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"ref","type":{"text":"Object | Function","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":9,"end":17}]},"description":"The reference\nto the resource that is being tracked.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The callback function to be called when the resource\nis finalized.","default":null,"optional":false,"rest":false,"properties":[{"name":"ref","type":{"text":"Object | Function","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":9,"end":17}]},"description":"The reference to the resource that is being tracked.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"event","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The event that triggered the finalization. Defaults to 'beforeExit'.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"This function behaves exactly like the `register`, except that the callback will be called\nwhen the process emits the `beforeExit` event if `ref` object was not garbage collected.\n\nBe aware that all limitations applied to the `beforeExit` event are also applied to the `callback` function,\nthis means that there is a possibility that the callback will not be called under special circumstances.","summary":"This function behaves exactly like the `register`, except that the callback will be called when the process emits the `beforeExit` event if `ref` object was not garbage collected.","examples":[],"children":[]},{"kind":"method","id":"processfinalizationunregisterref","name":"unregister","title":"`process.finalization.unregister(ref)`","scope":"global","overloadOf":null,"stability":{"index":"1.1","description":"Active Development"},"added":["v22.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"ref","type":{"text":"Object | Function","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6},{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":9,"end":17}]},"description":"The reference\nto the resource that was registered previously.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"This function remove the register of the object from the finalization\nregistry, so the callback will not be called anymore.\n\n```cjs\nconst { finalization } = require('node:process');\n\n// Please make sure that the function passed to finalization.register()\n// does not create a closure around unnecessary objects.\nfunction onFinalize(obj, event) {\n  // You can do whatever you want with the object\n  obj.dispose();\n}\n\nfunction setup() {\n  // This object can be safely garbage collected,\n  // and the resulting shutdown function will not be called.\n  // There are no leaks.\n  const myDisposableObject = {\n    dispose() {\n      // Free your resources synchronously\n    },\n  };\n\n  finalization.register(myDisposableObject, onFinalize);\n\n  // Do something\n\n  myDisposableObject.dispose();\n  finalization.unregister(myDisposableObject);\n}\n\nsetup();\n```\n\n```mjs\nimport { finalization } from 'node:process';\n\n// Please make sure that the function passed to finalization.register()\n// does not create a closure around unnecessary objects.\nfunction onFinalize(obj, event) {\n  // You can do whatever you want with the object\n  obj.dispose();\n}\n\nfunction setup() {\n  // This object can be safely garbage collected,\n  // and the resulting shutdown function will not be called.\n  // There are no leaks.\n  const myDisposableObject = {\n    dispose() {\n      // Free your resources synchronously\n    },\n  };\n\n  // Please make sure that the function passed to finalization.register()\n  // does not create a closure around unnecessary objects.\n  function onFinalize(obj, event) {\n    // You can do whatever you want with the object\n    obj.dispose();\n  }\n\n  finalization.register(myDisposableObject, onFinalize);\n\n  // Do something\n\n  myDisposableObject.dispose();\n  finalization.unregister(myDisposableObject);\n}\n\nsetup();\n```","summary":"This function remove the register of the object from the finalization registry, so the callback will not be called anymore.","examples":[{"language":"cjs","displayName":null,"code":"const { finalization } = require('node:process');\n\n// Please make sure that the function passed to finalization.register()\n// does not create a closure around unnecessary objects.\nfunction onFinalize(obj, event) {\n  // You can do whatever you want with the object\n  obj.dispose();\n}\n\nfunction setup() {\n  // This object can be safely garbage collected,\n  // and the resulting shutdown function will not be called.\n  // There are no leaks.\n  const myDisposableObject = {\n    dispose() {\n      // Free your resources synchronously\n    },\n  };\n\n  finalization.register(myDisposableObject, onFinalize);\n\n  // Do something\n\n  myDisposableObject.dispose();\n  finalization.unregister(myDisposableObject);\n}\n\nsetup();"},{"language":"mjs","displayName":null,"code":"import { finalization } from 'node:process';\n\n// Please make sure that the function passed to finalization.register()\n// does not create a closure around unnecessary objects.\nfunction onFinalize(obj, event) {\n  // You can do whatever you want with the object\n  obj.dispose();\n}\n\nfunction setup() {\n  // This object can be safely garbage collected,\n  // and the resulting shutdown function will not be called.\n  // There are no leaks.\n  const myDisposableObject = {\n    dispose() {\n      // Free your resources synchronously\n    },\n  };\n\n  // Please make sure that the function passed to finalization.register()\n  // does not create a closure around unnecessary objects.\n  function onFinalize(obj, event) {\n    // You can do whatever you want with the object\n    obj.dispose();\n  }\n\n  finalization.register(myDisposableObject, onFinalize);\n\n  // Do something\n\n  myDisposableObject.dispose();\n  finalization.unregister(myDisposableObject);\n}\n\nsetup();"}],"children":[]},{"kind":"method","id":"processgetactiveresourcesinfo","name":"getActiveResourcesInfo","title":"`process.getActiveResourcesInfo()`","scope":"global","overloadOf":null,"stability":null,"added":["v17.3.0","v16.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.0.0","v22.16.0"],"prUrl":"https://github.com/nodejs/node/pull/57765","commit":null,"description":"Change stability index for this feature from Experimental to Stable."}],"signature":{"parameters":[],"returns":{"type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":""}},"description":"The `process.getActiveResourcesInfo()` method returns an array of strings\ncontaining the types of the active resources that are currently keeping the\nevent loop alive.\n\n```mjs\nimport { getActiveResourcesInfo } from 'node:process';\nimport { setTimeout } from 'node:timers';\n\nconsole.log('Before:', getActiveResourcesInfo());\nsetTimeout(() => {}, 1000);\nconsole.log('After:', getActiveResourcesInfo());\n// Prints:\n//   Before: [ 'CloseReq', 'TTYWrap', 'TTYWrap', 'TTYWrap' ]\n//   After: [ 'CloseReq', 'TTYWrap', 'TTYWrap', 'TTYWrap', 'Timeout' ]\n```\n\n```cjs\nconst { getActiveResourcesInfo } = require('node:process');\nconst { setTimeout } = require('node:timers');\n\nconsole.log('Before:', getActiveResourcesInfo());\nsetTimeout(() => {}, 1000);\nconsole.log('After:', getActiveResourcesInfo());\n// Prints:\n//   Before: [ 'TTYWrap', 'TTYWrap', 'TTYWrap' ]\n//   After: [ 'TTYWrap', 'TTYWrap', 'TTYWrap', 'Timeout' ]\n```","summary":"The `process.getActiveResourcesInfo()` method returns an array of strings containing the types of the active resources that are currently keeping the event loop alive.","examples":[{"language":"mjs","displayName":null,"code":"import { getActiveResourcesInfo } from 'node:process';\nimport { setTimeout } from 'node:timers';\n\nconsole.log('Before:', getActiveResourcesInfo());\nsetTimeout(() => {}, 1000);\nconsole.log('After:', getActiveResourcesInfo());\n// Prints:\n//   Before: [ 'CloseReq', 'TTYWrap', 'TTYWrap', 'TTYWrap' ]\n//   After: [ 'CloseReq', 'TTYWrap', 'TTYWrap', 'TTYWrap', 'Timeout' ]"},{"language":"cjs","displayName":null,"code":"const { getActiveResourcesInfo } = require('node:process');\nconst { setTimeout } = require('node:timers');\n\nconsole.log('Before:', getActiveResourcesInfo());\nsetTimeout(() => {}, 1000);\nconsole.log('After:', getActiveResourcesInfo());\n// Prints:\n//   Before: [ 'TTYWrap', 'TTYWrap', 'TTYWrap' ]\n//   After: [ 'TTYWrap', 'TTYWrap', 'TTYWrap', 'Timeout' ]"}],"children":[]},{"kind":"method","id":"processgetbuiltinmoduleid","name":"getBuiltinModule","title":"`process.getBuiltinModule(id)`","scope":"global","overloadOf":null,"stability":null,"added":["v22.3.0","v20.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"id","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"ID of the built-in module being requested.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Object | undefined","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":9,"end":18}]},"description":""}},"description":"`process.getBuiltinModule(id)` provides a way to load built-in modules\nin a globally available function. ES Modules that need to support\nother environments can use it to conditionally load a Node.js built-in\nwhen it is run in Node.js, without having to deal with the resolution\nerror that can be thrown by `import` in a non-Node.js environment or\nhaving to use dynamic `import()` which either turns the module into\nan asynchronous module, or turns a synchronous API into an asynchronous one.\n\n```mjs\nif (globalThis.process?.getBuiltinModule) {\n  // Run in Node.js, use the Node.js fs module.\n  const fs = globalThis.process.getBuiltinModule('fs');\n  // If `require()` is needed to load user-modules, use createRequire()\n  const module = globalThis.process.getBuiltinModule('module');\n  const require = module.createRequire(import.meta.url);\n  const foo = require('foo');\n}\n```\n\nIf `id` specifies a built-in module available in the current Node.js process,\n`process.getBuiltinModule(id)` method returns the corresponding built-in\nmodule. If `id` does not correspond to any built-in module, `undefined`\nis returned.\n\n`process.getBuiltinModule(id)` accepts built-in module IDs that are recognized\nby [`module.isBuiltin(id)`](module.html#moduleisbuiltinmodulename). Some built-in modules must be loaded with the\n`node:` prefix, see [built-in modules with mandatory `node:` prefix](modules.html#built-in-modules-with-mandatory-node-prefix).\nThe references returned by `process.getBuiltinModule(id)` always point to\nthe built-in module corresponding to `id` even if users modify\n[`require.cache`](modules.html#requirecache) so that `require(id)` returns something else.","summary":"`process.getBuiltinModule(id)` provides a way to load built-in modules in a globally available function. ES Modules that need to support other environments can use it to conditionally load a Node.js built-in when it is run in Node.js, without having to deal with the resolution error that can be thrown by `import` in a non-Node.js environment or having to use dynamic `import()` which either turns the module into an asynchronous module, or turns a synchronous API into an asynchronous one.","examples":[{"language":"mjs","displayName":null,"code":"if (globalThis.process?.getBuiltinModule) {\n  // Run in Node.js, use the Node.js fs module.\n  const fs = globalThis.process.getBuiltinModule('fs');\n  // If `require()` is needed to load user-modules, use createRequire()\n  const module = globalThis.process.getBuiltinModule('module');\n  const require = module.createRequire(import.meta.url);\n  const foo = require('foo');\n}"}],"children":[]},{"kind":"method","id":"processgetegid","name":"getegid","title":"`process.getegid()`","scope":"global","overloadOf":null,"stability":null,"added":["v2.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"The `process.getegid()` method returns the numerical effective group identity\nof the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)\n\n```mjs\nimport process from 'node:process';\n\nif (process.getegid) {\n  console.log(`Current gid: ${process.getegid()}`);\n}\n```\n\n```cjs\nif (process.getegid) {\n  console.log(`Current gid: ${process.getegid()}`);\n}\n```\n\nThis function is only available on POSIX platforms (i.e. not Windows or\nAndroid).","summary":"The `process.getegid()` method returns the numerical effective group identity of the Node.js process. (See `getegid(2)`.)","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nif (process.getegid) {\n  console.log(`Current gid: ${process.getegid()}`);\n}"},{"language":"cjs","displayName":null,"code":"if (process.getegid) {\n  console.log(`Current gid: ${process.getegid()}`);\n}"}],"children":[]},{"kind":"method","id":"processgeteuid","name":"geteuid","title":"`process.geteuid()`","scope":"global","overloadOf":null,"stability":null,"added":["v2.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"The `process.geteuid()` method returns the numerical effective user identity of\nthe process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)\n\n```mjs\nimport process from 'node:process';\n\nif (process.geteuid) {\n  console.log(`Current uid: ${process.geteuid()}`);\n}\n```\n\n```cjs\nif (process.geteuid) {\n  console.log(`Current uid: ${process.geteuid()}`);\n}\n```\n\nThis function is only available on POSIX platforms (i.e. not Windows or\nAndroid).","summary":"The `process.geteuid()` method returns the numerical effective user identity of the process. (See `geteuid(2)`.)","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nif (process.geteuid) {\n  console.log(`Current uid: ${process.geteuid()}`);\n}"},{"language":"cjs","displayName":null,"code":"if (process.geteuid) {\n  console.log(`Current uid: ${process.geteuid()}`);\n}"}],"children":[]},{"kind":"method","id":"processgetgid","name":"getgid","title":"`process.getgid()`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.31"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"The `process.getgid()` method returns the numerical group identity of the\nprocess. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)\n\n```mjs\nimport process from 'node:process';\n\nif (process.getgid) {\n  console.log(`Current gid: ${process.getgid()}`);\n}\n```\n\n```cjs\nif (process.getgid) {\n  console.log(`Current gid: ${process.getgid()}`);\n}\n```\n\nThis function is only available on POSIX platforms (i.e. not Windows or\nAndroid).","summary":"The `process.getgid()` method returns the numerical group identity of the process. (See `getgid(2)`.)","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nif (process.getgid) {\n  console.log(`Current gid: ${process.getgid()}`);\n}"},{"language":"cjs","displayName":null,"code":"if (process.getgid) {\n  console.log(`Current gid: ${process.getgid()}`);\n}"}],"children":[]},{"kind":"method","id":"processgetgroups","name":"getgroups","title":"`process.getgroups()`","scope":"global","overloadOf":null,"stability":null,"added":["v0.9.4"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"integer[]","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":""}},"description":"The `process.getgroups()` method returns an array with the supplementary group\nIDs. POSIX leaves it unspecified if the effective group ID is included but\nNode.js ensures it always is.\n\n```mjs\nimport process from 'node:process';\n\nif (process.getgroups) {\n  console.log(process.getgroups()); // [ 16, 21, 297 ]\n}\n```\n\n```cjs\nif (process.getgroups) {\n  console.log(process.getgroups()); // [ 16, 21, 297 ]\n}\n```\n\nThis function is only available on POSIX platforms (i.e. not Windows or\nAndroid).","summary":"The `process.getgroups()` method returns an array with the supplementary group IDs. POSIX leaves it unspecified if the effective group ID is included but Node.js ensures it always is.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nif (process.getgroups) {\n  console.log(process.getgroups()); // [ 16, 21, 297 ]\n}"},{"language":"cjs","displayName":null,"code":"if (process.getgroups) {\n  console.log(process.getgroups()); // [ 16, 21, 297 ]\n}"}],"children":[]},{"kind":"method","id":"processgetuid","name":"getuid","title":"`process.getuid()`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.28"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":""}},"description":"The `process.getuid()` method returns the numeric user identity of the process.\n(See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)\n\n```mjs\nimport process from 'node:process';\n\nif (process.getuid) {\n  console.log(`Current uid: ${process.getuid()}`);\n}\n```\n\n```cjs\nif (process.getuid) {\n  console.log(`Current uid: ${process.getuid()}`);\n}\n```\n\nThis function not available on Windows.","summary":"The `process.getuid()` method returns the numeric user identity of the process. (See `getuid(2)`.)","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nif (process.getuid) {\n  console.log(`Current uid: ${process.getuid()}`);\n}"},{"language":"cjs","displayName":null,"code":"if (process.getuid) {\n  console.log(`Current uid: ${process.getuid()}`);\n}"}],"children":[]},{"kind":"method","id":"processhasuncaughtexceptioncapturecallback","name":"hasUncaughtExceptionCaptureCallback","title":"`process.hasUncaughtExceptionCaptureCallback()`","scope":"global","overloadOf":null,"stability":null,"added":["v9.3.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Indicates whether a callback has been set using\n[`process.setUncaughtExceptionCaptureCallback()`](#processsetuncaughtexceptioncapturecallbackfn).","summary":"Indicates whether a callback has been set using `process.setUncaughtExceptionCaptureCallback()`.","examples":[],"children":[]},{"kind":"method","id":"processhrtimetime","name":"hrtime","title":"`process.hrtime([time])`","scope":"global","overloadOf":null,"stability":{"index":"3","description":"Legacy. Use [`process.hrtime.bigint()`](#processhrtimebigint) instead."},"added":["v0.7.6"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"time","type":{"text":"integer[]","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"The result of a previous call to `process.hrtime()`","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"integer[]","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":""}},"description":"This is the legacy version of [`process.hrtime.bigint()`](#processhrtimebigint)\nbefore `bigint` was introduced in JavaScript.\n\nThe `process.hrtime()` method returns the current high-resolution real time\nin a `[seconds, nanoseconds]` tuple `Array`, where `nanoseconds` is the\nremaining part of the real time that can't be represented in second precision.\n\n`time` is an optional parameter that must be the result of a previous\n`process.hrtime()` call to diff with the current time. If the parameter\npassed in is not a tuple `Array`, a `TypeError` will be thrown. Passing in a\nuser-defined array instead of the result of a previous call to\n`process.hrtime()` will lead to undefined behavior.\n\nThese times are relative to an arbitrary time in the\npast, and not related to the time of day and therefore not subject to clock\ndrift. The primary use is for measuring performance between intervals:\n\n```mjs\nimport { hrtime } from 'node:process';\n\nconst NS_PER_SEC = 1e9;\nconst time = hrtime();\n// [ 1800216, 25 ]\n\nsetTimeout(() => {\n  const diff = hrtime(time);\n  // [ 1, 552 ]\n\n  console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);\n  // Benchmark took 1000000552 nanoseconds\n}, 1000);\n```\n\n```cjs\nconst { hrtime } = require('node:process');\n\nconst NS_PER_SEC = 1e9;\nconst time = hrtime();\n// [ 1800216, 25 ]\n\nsetTimeout(() => {\n  const diff = hrtime(time);\n  // [ 1, 552 ]\n\n  console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);\n  // Benchmark took 1000000552 nanoseconds\n}, 1000);\n```","summary":"This is the legacy version of `process.hrtime.bigint()` before `bigint` was introduced in JavaScript.","examples":[{"language":"mjs","displayName":null,"code":"import { hrtime } from 'node:process';\n\nconst NS_PER_SEC = 1e9;\nconst time = hrtime();\n// [ 1800216, 25 ]\n\nsetTimeout(() => {\n  const diff = hrtime(time);\n  // [ 1, 552 ]\n\n  console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);\n  // Benchmark took 1000000552 nanoseconds\n}, 1000);"},{"language":"cjs","displayName":null,"code":"const { hrtime } = require('node:process');\n\nconst NS_PER_SEC = 1e9;\nconst time = hrtime();\n// [ 1800216, 25 ]\n\nsetTimeout(() => {\n  const diff = hrtime(time);\n  // [ 1, 552 ]\n\n  console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);\n  // Benchmark took 1000000552 nanoseconds\n}, 1000);"}],"children":[]},{"kind":"method","id":"processhrtimebigint","name":"bigint","title":"`process.hrtime.bigint()`","scope":"global","overloadOf":null,"stability":null,"added":["v10.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"description":""}},"description":"The `bigint` version of the [`process.hrtime()`](#processhrtimetime) method returning the\ncurrent high-resolution real time in nanoseconds as a `bigint`.\n\nUnlike [`process.hrtime()`](#processhrtimetime), it does not support an additional `time`\nargument since the difference can just be computed directly\nby subtraction of the two `bigint`s.\n\n```mjs\nimport { hrtime } from 'node:process';\n\nconst start = hrtime.bigint();\n// 191051479007711n\n\nsetTimeout(() => {\n  const end = hrtime.bigint();\n  // 191052633396993n\n\n  console.log(`Benchmark took ${end - start} nanoseconds`);\n  // Benchmark took 1154389282 nanoseconds\n}, 1000);\n```\n\n```cjs\nconst { hrtime } = require('node:process');\n\nconst start = hrtime.bigint();\n// 191051479007711n\n\nsetTimeout(() => {\n  const end = hrtime.bigint();\n  // 191052633396993n\n\n  console.log(`Benchmark took ${end - start} nanoseconds`);\n  // Benchmark took 1154389282 nanoseconds\n}, 1000);\n```","summary":"The `bigint` version of the `process.hrtime()` method returning the current high-resolution real time in nanoseconds as a `bigint`.","examples":[{"language":"mjs","displayName":null,"code":"import { hrtime } from 'node:process';\n\nconst start = hrtime.bigint();\n// 191051479007711n\n\nsetTimeout(() => {\n  const end = hrtime.bigint();\n  // 191052633396993n\n\n  console.log(`Benchmark took ${end - start} nanoseconds`);\n  // Benchmark took 1154389282 nanoseconds\n}, 1000);"},{"language":"cjs","displayName":null,"code":"const { hrtime } = require('node:process');\n\nconst start = hrtime.bigint();\n// 191051479007711n\n\nsetTimeout(() => {\n  const end = hrtime.bigint();\n  // 191052633396993n\n\n  console.log(`Benchmark took ${end - start} nanoseconds`);\n  // Benchmark took 1154389282 nanoseconds\n}, 1000);"}],"children":[]},{"kind":"method","id":"processinitgroupsuser-extragroup","name":"initgroups","title":"`process.initgroups(user, extraGroup)`","scope":"global","overloadOf":null,"stability":null,"added":["v0.9.4"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"user","type":{"text":"string | number","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":9,"end":15}]},"description":"The user name or numeric identifier.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"extraGroup","type":{"text":"string | number","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":9,"end":15}]},"description":"A group name or numeric identifier.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The `process.initgroups()` method reads the `/etc/group` file and initializes\nthe group access list, using all groups of which the user is a member. This is\na privileged operation that requires that the Node.js process either have `root`\naccess or the `CAP_SETGID` capability.\n\nUse care when dropping privileges:\n\n```mjs\nimport { getgroups, initgroups, setgid } from 'node:process';\n\nconsole.log(getgroups());         // [ 0 ]\ninitgroups('nodeuser', 1000);     // switch user\nconsole.log(getgroups());         // [ 27, 30, 46, 1000, 0 ]\nsetgid(1000);                     // drop root gid\nconsole.log(getgroups());         // [ 27, 30, 46, 1000 ]\n```\n\n```cjs\nconst { getgroups, initgroups, setgid } = require('node:process');\n\nconsole.log(getgroups());         // [ 0 ]\ninitgroups('nodeuser', 1000);     // switch user\nconsole.log(getgroups());         // [ 27, 30, 46, 1000, 0 ]\nsetgid(1000);                     // drop root gid\nconsole.log(getgroups());         // [ 27, 30, 46, 1000 ]\n```\n\nThis function is only available on POSIX platforms (i.e. not Windows or\nAndroid).\nThis feature is not available in [`Worker`](worker_threads.html#class-worker) threads.","summary":"The `process.initgroups()` method reads the `/etc/group` file and initializes the group access list, using all groups of which the user is a member. This is a privileged operation that requires that the Node.js process either have `root` access or the `CAP_SETGID` capability.","examples":[{"language":"mjs","displayName":null,"code":"import { getgroups, initgroups, setgid } from 'node:process';\n\nconsole.log(getgroups());         // [ 0 ]\ninitgroups('nodeuser', 1000);     // switch user\nconsole.log(getgroups());         // [ 27, 30, 46, 1000, 0 ]\nsetgid(1000);                     // drop root gid\nconsole.log(getgroups());         // [ 27, 30, 46, 1000 ]"},{"language":"cjs","displayName":null,"code":"const { getgroups, initgroups, setgid } = require('node:process');\n\nconsole.log(getgroups());         // [ 0 ]\ninitgroups('nodeuser', 1000);     // switch user\nconsole.log(getgroups());         // [ 27, 30, 46, 1000, 0 ]\nsetgid(1000);                     // drop root gid\nconsole.log(getgroups());         // [ 27, 30, 46, 1000 ]"}],"children":[]},{"kind":"method","id":"processkillpid-signal","name":"kill","title":"`process.kill(pid[, signal])`","scope":"global","overloadOf":null,"stability":null,"added":["v0.0.6"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"pid","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"A process ID","default":null,"optional":false,"rest":false,"properties":[]},{"name":"signal","type":{"text":"string | number","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":9,"end":15}]},"description":"The signal to send, either as a string or number.","default":"'SIGTERM'","optional":true,"rest":false,"properties":[]}],"returns":null},"description":"The `process.kill()` method sends the `signal` to the process identified by\n`pid`.\n\nSignal names are strings such as `'SIGINT'` or `'SIGHUP'`. See [Signal Events](#signal-events) and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information.\n\nThis method will throw an error if the target `pid` does not exist. As a special\ncase, a signal of `0` can be used to test for the existence of a process.\nWindows platforms will throw an error if the `pid` is used to kill a process\ngroup.\n\nEven though the name of this function is `process.kill()`, it is really just a\nsignal sender, like the `kill` system call. The signal sent may do something\nother than kill the target process.\n\n```mjs\nimport process, { kill } from 'node:process';\n\nprocess.on('SIGHUP', () => {\n  console.log('Got SIGHUP signal.');\n});\n\nsetTimeout(() => {\n  console.log('Exiting.');\n  process.exit(0);\n}, 100);\n\nkill(process.pid, 'SIGHUP');\n```\n\n```cjs\nprocess.on('SIGHUP', () => {\n  console.log('Got SIGHUP signal.');\n});\n\nsetTimeout(() => {\n  console.log('Exiting.');\n  process.exit(0);\n}, 100);\n\nprocess.kill(process.pid, 'SIGHUP');\n```\n\nWhen `SIGUSR1` is received by a Node.js process, Node.js will start the\ndebugger. See [Signal Events](#signal-events).","summary":"The `process.kill()` method sends the `signal` to the process identified by `pid`.","examples":[{"language":"mjs","displayName":null,"code":"import process, { kill } from 'node:process';\n\nprocess.on('SIGHUP', () => {\n  console.log('Got SIGHUP signal.');\n});\n\nsetTimeout(() => {\n  console.log('Exiting.');\n  process.exit(0);\n}, 100);\n\nkill(process.pid, 'SIGHUP');"},{"language":"cjs","displayName":null,"code":"process.on('SIGHUP', () => {\n  console.log('Got SIGHUP signal.');\n});\n\nsetTimeout(() => {\n  console.log('Exiting.');\n  process.exit(0);\n}, 100);\n\nprocess.kill(process.pid, 'SIGHUP');"}],"children":[]},{"kind":"method","id":"processloadenvfilepath","name":"loadEnvFile","title":"`process.loadEnvFile(path)`","scope":"global","overloadOf":null,"stability":null,"added":["v21.7.0","v20.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.10.0","v22.21.0"],"prUrl":"https://github.com/nodejs/node/pull/59925","commit":null,"description":"This API is no longer experimental."}],"signature":{"parameters":[{"name":"path","type":{"text":"string | URL | Buffer | undefined","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"URL","href":"url.html#the-whatwg-url-api","start":9,"end":12},{"name":"Buffer","href":"buffer.html#class-buffer","start":15,"end":21},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":24,"end":33}]},"description":".","default":"'./.env'","optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Loads the `.env` file into `process.env`. Usage of `NODE_OPTIONS`\nin the `.env` file will not have any effect on Node.js.\n\n```cjs\nconst { loadEnvFile } = require('node:process');\nloadEnvFile();\n```\n\n```mjs\nimport { loadEnvFile } from 'node:process';\nloadEnvFile();\n```","summary":"Loads the `.env` file into `process.env`. Usage of `NODE_OPTIONS` in the `.env` file will not have any effect on Node.js.","examples":[{"language":"cjs","displayName":null,"code":"const { loadEnvFile } = require('node:process');\nloadEnvFile();"},{"language":"mjs","displayName":null,"code":"import { loadEnvFile } from 'node:process';\nloadEnvFile();"}],"children":[]},{"kind":"property","id":"processmainmodule","name":"mainModule","title":"`process.mainModule`","scope":"global","overloadOf":null,"stability":{"index":"0","description":"Deprecated: Use [`require.main`](modules.html#accessing-the-main-module) instead."},"added":["v0.1.17"],"deprecated":["v14.0.0"],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"The `process.mainModule` property provides an alternative way of retrieving\n[`require.main`](modules.html#accessing-the-main-module). The difference is that if the main module changes at\nruntime, [`require.main`](modules.html#accessing-the-main-module) may still refer to the original main module in\nmodules that were required before the change occurred. Generally, it's\nsafe to assume that the two refer to the same module.\n\nAs with [`require.main`](modules.html#accessing-the-main-module), `process.mainModule` will be `undefined` if there\nis no entry script.","summary":"The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at runtime, `require.main` may still refer to the original main module in modules that were required before the change occurred. Generally, it's safe to assume that the two refer to the same module.","examples":[],"children":[]},{"kind":"method","id":"processmemoryusage","name":"memoryUsage","title":"`process.memoryUsage()`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.16"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.9.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/31550","commit":null,"description":"Added `arrayBuffers` to the returned object."},{"versions":["v7.2.0"],"prUrl":"https://github.com/nodejs/node/pull/9587","commit":null,"description":"Added `external` to the returned object."}],"signature":{"parameters":[],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"Returns an object describing the memory usage of the Node.js process measured in\nbytes.\n\n```mjs\nimport { memoryUsage } from 'node:process';\n\nconsole.log(memoryUsage());\n// Prints:\n// {\n//  rss: 4935680,\n//  heapTotal: 1826816,\n//  heapUsed: 650472,\n//  external: 49879,\n//  arrayBuffers: 9386\n// }\n```\n\n```cjs\nconst { memoryUsage } = require('node:process');\n\nconsole.log(memoryUsage());\n// Prints:\n// {\n//  rss: 4935680,\n//  heapTotal: 1826816,\n//  heapUsed: 650472,\n//  external: 49879,\n//  arrayBuffers: 9386\n// }\n```\n\n* `heapTotal` and `heapUsed` refer to V8's memory usage.\n* `external` refers to the memory usage of C++ objects bound to JavaScript\n  objects managed by V8.\n* `rss`, Resident Set Size, is the amount of space occupied in the main\n  memory device (that is a subset of the total allocated memory) for the\n  process, including all C++ and JavaScript objects and code.\n* `arrayBuffers` refers to memory allocated for `ArrayBuffer`s and\n  `SharedArrayBuffer`s, including all Node.js [`Buffer`](buffer.html)s.\n  This is also included in the `external` value. When Node.js is used as an\n  embedded library, this value may be `0` because allocations for `ArrayBuffer`s\n  may not be tracked in that case.\n\nWhen using [`Worker`](worker_threads.html#class-worker) threads, `rss` will be a value that is valid for the\nentire process, while the other fields will only refer to the current thread.\n\nThe `process.memoryUsage()` method iterates over each page to gather\ninformation about memory usage which might be slow depending on the\nprogram memory allocations.","summary":"Returns an object describing the memory usage of the Node.js process measured in bytes.","examples":[{"language":"mjs","displayName":null,"code":"import { memoryUsage } from 'node:process';\n\nconsole.log(memoryUsage());\n// Prints:\n// {\n//  rss: 4935680,\n//  heapTotal: 1826816,\n//  heapUsed: 650472,\n//  external: 49879,\n//  arrayBuffers: 9386\n// }"},{"language":"cjs","displayName":null,"code":"const { memoryUsage } = require('node:process');\n\nconsole.log(memoryUsage());\n// Prints:\n// {\n//  rss: 4935680,\n//  heapTotal: 1826816,\n//  heapUsed: 650472,\n//  external: 49879,\n//  arrayBuffers: 9386\n// }"}],"children":[{"kind":"section","id":"a-note-on-process-memoryusage","name":"A note on process memoryUsage","title":"A note on process memoryUsage","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"On Linux or other systems where glibc is commonly used, an application may have sustained\n`rss` growth despite stable `heapTotal` due to fragmentation caused by the glibc `malloc`\nimplementation. See [nodejs/node#21973](https://github.com/nodejs/node/issues/21973) on how to switch to an alternative `malloc`\nimplementation to address the performance issue.","summary":"On Linux or other systems where glibc is commonly used, an application may have sustained `rss` growth despite stable `heapTotal` due to fragmentation caused by the glibc `malloc` implementation. See nodejs/node#21973 on how to switch to an alternative `malloc` implementation to address the performance issue.","examples":[],"children":[]}]},{"kind":"method","id":"processmemoryusagerss","name":"rss","title":"`process.memoryUsage.rss()`","scope":"global","overloadOf":null,"stability":null,"added":["v15.6.0","v14.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":""}},"description":"The `process.memoryUsage.rss()` method returns an integer representing the\nResident Set Size (RSS) in bytes.\n\nThe Resident Set Size, is the amount of space occupied in the main\nmemory device (that is a subset of the total allocated memory) for the\nprocess, including all C++ and JavaScript objects and code.\n\nThis is the same value as the `rss` property provided by `process.memoryUsage()`\nbut `process.memoryUsage.rss()` is faster.\n\n```mjs\nimport { memoryUsage } from 'node:process';\n\nconsole.log(memoryUsage.rss());\n// 35655680\n```\n\n```cjs\nconst { memoryUsage } = require('node:process');\n\nconsole.log(memoryUsage.rss());\n// 35655680\n```","summary":"The `process.memoryUsage.rss()` method returns an integer representing the Resident Set Size (RSS) in bytes.","examples":[{"language":"mjs","displayName":null,"code":"import { memoryUsage } from 'node:process';\n\nconsole.log(memoryUsage.rss());\n// 35655680"},{"language":"cjs","displayName":null,"code":"const { memoryUsage } = require('node:process');\n\nconsole.log(memoryUsage.rss());\n// 35655680"}],"children":[]},{"kind":"method","id":"processnexttickcallback-args","name":"nextTick","title":"`process.nextTick(callback[, ...args])`","scope":"global","overloadOf":null,"stability":{"index":"3","description":"Legacy: Use [`queueMicrotask()`](globals.html#queuemicrotaskcallback) instead."},"added":["v0.1.26"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v22.7.0","v20.18.0"],"prUrl":"https://github.com/nodejs/node/pull/51280","commit":null,"description":"Changed stability to Legacy."},{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."},{"versions":["v1.8.1"],"prUrl":"https://github.com/nodejs/node/pull/1077","commit":null,"description":"Additional arguments after `callback` are now supported."}],"signature":{"parameters":[{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"args","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"Additional arguments to pass when invoking the `callback`","default":null,"optional":true,"rest":true,"properties":[]}],"returns":null},"description":"`process.nextTick()` adds `callback` to the \"next tick queue\". This queue is\nfully drained after the current operation on the JavaScript stack runs to\ncompletion and before the event loop is allowed to continue. It's possible to\ncreate an infinite loop if one were to recursively call `process.nextTick()`.\nSee the [Event Loop](https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick#understanding-processnexttick) guide for more background.\n\n```mjs\nimport { nextTick } from 'node:process';\n\nconsole.log('start');\nnextTick(() => {\n  console.log('nextTick callback');\n});\nconsole.log('scheduled');\n// Output:\n// start\n// scheduled\n// nextTick callback\n```\n\n```cjs\nconst { nextTick } = require('node:process');\n\nconsole.log('start');\nnextTick(() => {\n  console.log('nextTick callback');\n});\nconsole.log('scheduled');\n// Output:\n// start\n// scheduled\n// nextTick callback\n```\n\nThis is important when developing APIs in order to give users the opportunity\nto assign event handlers *after* an object has been constructed but before any\nI/O has occurred:\n\n```mjs\nimport { nextTick } from 'node:process';\n\nfunction MyThing(options) {\n  this.setupOptions(options);\n\n  nextTick(() => {\n    this.startDoingStuff();\n  });\n}\n\nconst thing = new MyThing();\nthing.getReadyForStuff();\n\n// thing.startDoingStuff() gets called now, not before.\n```\n\n```cjs\nconst { nextTick } = require('node:process');\n\nfunction MyThing(options) {\n  this.setupOptions(options);\n\n  nextTick(() => {\n    this.startDoingStuff();\n  });\n}\n\nconst thing = new MyThing();\nthing.getReadyForStuff();\n\n// thing.startDoingStuff() gets called now, not before.\n```\n\nIt is very important for APIs to be either 100% synchronous or 100%\nasynchronous. Consider this example:\n\n```js\n// WARNING!  DO NOT USE!  BAD UNSAFE HAZARD!\nfunction maybeSync(arg, cb) {\n  if (arg) {\n    cb();\n    return;\n  }\n\n  fs.stat('file', cb);\n}\n```\n\nThis API is hazardous because in the following case:\n\n```js\nconst maybeTrue = Math.random() > 0.5;\n\nmaybeSync(maybeTrue, () => {\n  foo();\n});\n\nbar();\n```\n\nIt is not clear whether `foo()` or `bar()` will be called first.\n\nThe following approach is much better:\n\n```mjs\nimport { nextTick } from 'node:process';\n\nfunction definitelyAsync(arg, cb) {\n  if (arg) {\n    nextTick(cb);\n    return;\n  }\n\n  fs.stat('file', cb);\n}\n```\n\n```cjs\nconst { nextTick } = require('node:process');\n\nfunction definitelyAsync(arg, cb) {\n  if (arg) {\n    nextTick(cb);\n    return;\n  }\n\n  fs.stat('file', cb);\n}\n```","summary":"`process.nextTick()` adds `callback` to the \"next tick queue\". This queue is fully drained after the current operation on the JavaScript stack runs to completion and before the event loop is allowed to continue. It's possible to create an infinite loop if one were to recursively call `process.nextTick()`. See the Event Loop guide for more background.","examples":[{"language":"mjs","displayName":null,"code":"import { nextTick } from 'node:process';\n\nconsole.log('start');\nnextTick(() => {\n  console.log('nextTick callback');\n});\nconsole.log('scheduled');\n// Output:\n// start\n// scheduled\n// nextTick callback"},{"language":"cjs","displayName":null,"code":"const { nextTick } = require('node:process');\n\nconsole.log('start');\nnextTick(() => {\n  console.log('nextTick callback');\n});\nconsole.log('scheduled');\n// Output:\n// start\n// scheduled\n// nextTick callback"},{"language":"mjs","displayName":null,"code":"import { nextTick } from 'node:process';\n\nfunction MyThing(options) {\n  this.setupOptions(options);\n\n  nextTick(() => {\n    this.startDoingStuff();\n  });\n}\n\nconst thing = new MyThing();\nthing.getReadyForStuff();\n\n// thing.startDoingStuff() gets called now, not before."},{"language":"cjs","displayName":null,"code":"const { nextTick } = require('node:process');\n\nfunction MyThing(options) {\n  this.setupOptions(options);\n\n  nextTick(() => {\n    this.startDoingStuff();\n  });\n}\n\nconst thing = new MyThing();\nthing.getReadyForStuff();\n\n// thing.startDoingStuff() gets called now, not before."},{"language":"js","displayName":null,"code":"// WARNING!  DO NOT USE!  BAD UNSAFE HAZARD!\nfunction maybeSync(arg, cb) {\n  if (arg) {\n    cb();\n    return;\n  }\n\n  fs.stat('file', cb);\n}"},{"language":"js","displayName":null,"code":"const maybeTrue = Math.random() > 0.5;\n\nmaybeSync(maybeTrue, () => {\n  foo();\n});\n\nbar();"},{"language":"mjs","displayName":null,"code":"import { nextTick } from 'node:process';\n\nfunction definitelyAsync(arg, cb) {\n  if (arg) {\n    nextTick(cb);\n    return;\n  }\n\n  fs.stat('file', cb);\n}"},{"language":"cjs","displayName":null,"code":"const { nextTick } = require('node:process');\n\nfunction definitelyAsync(arg, cb) {\n  if (arg) {\n    nextTick(cb);\n    return;\n  }\n\n  fs.stat('file', cb);\n}"}],"children":[{"kind":"section","id":"when-to-use-queuemicrotask-vs-processnexttick","name":"When to use queueMicrotask() vs. process.nextTick()","title":"When to use `queueMicrotask()` vs. `process.nextTick()`","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The [`queueMicrotask()`](globals.html#queuemicrotaskcallback) API is an alternative to `process.nextTick()` that instead of using the\n\"next tick queue\" defers execution of a function using the same microtask queue used to execute the\nthen, catch, and finally handlers of resolved promises.\n\nWithin Node.js, every time the \"next tick queue\" is drained, the microtask queue\nis drained immediately after.\n\nSo in CJS modules `process.nextTick()` callbacks are always run before `queueMicrotask()` ones.\nHowever since ESM modules are processed already as part of the microtask queue, there\n`queueMicrotask()` callbacks are always executed before `process.nextTick()` ones since Node.js\nis already in the process of draining the microtask queue.\n\n```mjs\nimport { nextTick } from 'node:process';\n\nPromise.resolve().then(() => console.log('resolve'));\nqueueMicrotask(() => console.log('microtask'));\nnextTick(() => console.log('nextTick'));\n// Output:\n// resolve\n// microtask\n// nextTick\n```\n\n```cjs\nconst { nextTick } = require('node:process');\n\nPromise.resolve().then(() => console.log('resolve'));\nqueueMicrotask(() => console.log('microtask'));\nnextTick(() => console.log('nextTick'));\n// Output:\n// nextTick\n// resolve\n// microtask\n```\n\nFor *most* userland use cases, the `queueMicrotask()` API provides a portable\nand reliable mechanism for deferring execution that works across multiple\nJavaScript platform environments and should be favored over `process.nextTick()`.\nIn simple scenarios, `queueMicrotask()` can be a drop-in replacement for\n`process.nextTick()`.\n\n```js\nconsole.log('start');\nqueueMicrotask(() => {\n  console.log('microtask callback');\n});\nconsole.log('scheduled');\n// Output:\n// start\n// scheduled\n// microtask callback\n```\n\nOne note-worthy difference between the two APIs is that `process.nextTick()`\nallows specifying additional values that will be passed as arguments to the\ndeferred function when it is called. Achieving the same result with\n`queueMicrotask()` requires using either a closure or a bound function:\n\n```js\nfunction deferred(a, b) {\n  console.log('microtask', a + b);\n}\n\nconsole.log('start');\nqueueMicrotask(deferred.bind(undefined, 1, 2));\nconsole.log('scheduled');\n// Output:\n// start\n// scheduled\n// microtask 3\n```\n\nThere are minor differences in the way errors raised from within the next tick\nqueue and microtask queue are handled. Errors thrown within a queued microtask\ncallback should be handled within the queued callback when possible. If they are\nnot, the `process.on('uncaughtException')` event handler can be used to capture\nand handle the errors.\n\nWhen in doubt, unless the specific capabilities of `process.nextTick()` are\nneeded, use `queueMicrotask()`.","summary":"The `queueMicrotask()` API is an alternative to `process.nextTick()` that instead of using the \"next tick queue\" defers execution of a function using the same microtask queue used to execute the then, catch, and finally handlers of resolved promises.","examples":[{"language":"mjs","displayName":null,"code":"import { nextTick } from 'node:process';\n\nPromise.resolve().then(() => console.log('resolve'));\nqueueMicrotask(() => console.log('microtask'));\nnextTick(() => console.log('nextTick'));\n// Output:\n// resolve\n// microtask\n// nextTick"},{"language":"cjs","displayName":null,"code":"const { nextTick } = require('node:process');\n\nPromise.resolve().then(() => console.log('resolve'));\nqueueMicrotask(() => console.log('microtask'));\nnextTick(() => console.log('nextTick'));\n// Output:\n// nextTick\n// resolve\n// microtask"},{"language":"js","displayName":null,"code":"console.log('start');\nqueueMicrotask(() => {\n  console.log('microtask callback');\n});\nconsole.log('scheduled');\n// Output:\n// start\n// scheduled\n// microtask callback"},{"language":"js","displayName":null,"code":"function deferred(a, b) {\n  console.log('microtask', a + b);\n}\n\nconsole.log('start');\nqueueMicrotask(deferred.bind(undefined, 1, 2));\nconsole.log('scheduled');\n// Output:\n// start\n// scheduled\n// microtask 3"}],"children":[]}]},{"kind":"property","id":"processnodeprecation","name":"noDeprecation","title":"`process.noDeprecation`","scope":"global","overloadOf":null,"stability":null,"added":["v0.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"The `process.noDeprecation` property indicates whether the `--no-deprecation`\nflag is set on the current Node.js process. See the documentation for\nthe [`'warning'` event](#event-warning) and the\n[`emitWarning()` method](#processemitwarningwarning-type-code-ctor) for more information about this\nflag's behavior.","summary":"The `process.noDeprecation` property indicates whether the `--no-deprecation` flag is set on the current Node.js process. See the documentation for the `'warning'` event and the `emitWarning()` method for more information about this flag's behavior.","examples":[],"children":[]},{"kind":"property","id":"processpermission","name":"permission","title":"`process.permission`","scope":"global","overloadOf":null,"stability":null,"added":["v20.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"This API is available through the [`--permission`](cli.html#--permission) or\n[`--permission-audit`](cli.html#--permission-audit) flags.\n\n`process.permission` is an object whose methods are used to manage permissions\nfor the current process. Additional documentation is available in the\n[Permission Model](permissions.html#permission-model).","summary":"This API is available through the `--permission` or `--permission-audit` flags.","examples":[],"children":[{"kind":"method","id":"processpermissionhasscope-reference","name":"has","title":"`process.permission.has(scope[, reference])`","scope":"global","overloadOf":null,"stability":null,"added":["v20.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"scope","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"reference","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Verifies that the process is able to access the given scope and reference.\nIf no reference is provided, a global scope is assumed, for instance,\n`process.permission.has('fs.read')` will check if the process has ALL\nfile system read permissions.\n\nIn audit mode ([`--permission-audit`](cli.html#--permission-audit)), this method still returns the actual\npermission status, but denied operations will not throw `ERR_ACCESS_DENIED`.\n\nThe reference has a meaning based on the provided scope. For example,\nthe reference when the scope is File System means files and folders.\n\nThe available scopes are:\n\n* `fs` - All File System\n* `fs.read` - File System read operations\n* `fs.write` - File System write operations\n* `child` - Child process spawning operations\n* `openssl.store` - Loading keys through OpenSSL STORE loaders\n* `worker` - Worker thread spawning operation\n* `ffi` - Foreign function interface operations\n\n```js\n// Check if the process has permission to read the README file\nprocess.permission.has('fs.read', './README.md');\n// Check if the process has read permission operations\nprocess.permission.has('fs.read');\n```","summary":"Verifies that the process is able to access the given scope and reference. If no reference is provided, a global scope is assumed, for instance, `process.permission.has('fs.read')` will check if the process has ALL file system read permissions.","examples":[{"language":"js","displayName":null,"code":"// Check if the process has permission to read the README file\nprocess.permission.has('fs.read', './README.md');\n// Check if the process has read permission operations\nprocess.permission.has('fs.read');"}],"children":[]},{"kind":"method","id":"processpermissiondropscope-reference","name":"drop","title":"`process.permission.drop(scope[, reference])`","scope":"global","overloadOf":null,"stability":{"index":"1.1","description":"Active Development"},"added":["v26.3.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"scope","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"reference","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Drops the specified permission from the current process. This operation is\n**irreversible** — once a permission is dropped, it cannot be restored through\nany Node.js API.\n\nIn audit mode ([`--permission-audit`](cli.html#--permission-audit)), dropping a permission takes effect,\nbut since denied operations do not throw, the impact is limited to changing the\nreturn value of `permission.has()`.\n\nIf no reference is provided, the entire scope is dropped. For example,\n`process.permission.drop('fs.read')` will revoke ALL file system read\npermissions.\n\nWhen a reference is provided, only the permission for that specific resource\nis dropped. For example, `process.permission.drop('fs.read', '/etc/myapp')`\nwill revoke read access to that directory while keeping other read\npermissions intact.\n\n**Important:** You can only drop the exact resource that was explicitly\ngranted. The reference passed to `drop()` must match the original grant:\n\n* If a permission was granted using a wildcard (`*`), such as\n  `--allow-fs-read=*`, individual paths cannot be dropped - only the entire\n  scope can be dropped (by calling `drop()` without a reference).\n* If a directory was granted (e.g. `--allow-fs-read=/my/folder`), you cannot\n  drop access to individual files inside it. You must drop the same directory\n  that was granted. Any remaining grants continue to apply.\n\nThe available scopes are the same as [`process.permission.has()`](#processpermissionhasscope-reference):\n\n* `fs` - All File System (drops both read and write)\n* `fs.read` - File System read operations\n* `fs.write` - File System write operations\n* `child` - Child process spawning operations\n* `openssl.store` - Loading keys through OpenSSL STORE loaders\n* `worker` - Worker thread spawning operation\n* `net` - Network operations\n* `inspector` - Inspector operations\n* `wasi` - WASI operations\n* `addon` - Native addon operations\n\n```js\nconst fs = require('node:fs');\n\n// Read configuration during startup\nconst config = fs.readFileSync('/etc/myapp/config.json', 'utf8');\n\n// Drop read access to the config directory after initialization\nprocess.permission.drop('fs.read', '/etc/myapp');\n\n// This will now throw ERR_ACCESS_DENIED\nfs.readFileSync('/etc/myapp/config.json');\n```","summary":"Drops the specified permission from the current process. This operation is **irreversible** — once a permission is dropped, it cannot be restored through any Node.js API.","examples":[{"language":"js","displayName":null,"code":"const fs = require('node:fs');\n\n// Read configuration during startup\nconst config = fs.readFileSync('/etc/myapp/config.json', 'utf8');\n\n// Drop read access to the config directory after initialization\nprocess.permission.drop('fs.read', '/etc/myapp');\n\n// This will now throw ERR_ACCESS_DENIED\nfs.readFileSync('/etc/myapp/config.json');"}],"children":[]}]},{"kind":"property","id":"processpid","name":"pid","title":"`process.pid`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.15"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"default":null,"description":"The `process.pid` property returns the PID of the process.\n\n```mjs\nimport { pid } from 'node:process';\n\nconsole.log(`This process is pid ${pid}`);\n```\n\n```cjs\nconst { pid } = require('node:process');\n\nconsole.log(`This process is pid ${pid}`);\n```","summary":"The `process.pid` property returns the PID of the process.","examples":[{"language":"mjs","displayName":null,"code":"import { pid } from 'node:process';\n\nconsole.log(`This process is pid ${pid}`);"},{"language":"cjs","displayName":null,"code":"const { pid } = require('node:process');\n\nconsole.log(`This process is pid ${pid}`);"}],"children":[]},{"kind":"property","id":"processplatform","name":"platform","title":"`process.platform`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.16"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The `process.platform` property returns a string identifying the operating\nsystem platform for which the Node.js binary was compiled.\n\nCurrently possible values are:\n\n* `'aix'`\n* `'darwin'`\n* `'freebsd'`\n* `'linux'`\n* `'openbsd'`\n* `'sunos'`\n* `'win32'`\n\n```mjs\nimport { platform } from 'node:process';\n\nconsole.log(`This platform is ${platform}`);\n```\n\n```cjs\nconst { platform } = require('node:process');\n\nconsole.log(`This platform is ${platform}`);\n```\n\nThe value `'android'` may also be returned if Node.js is built on the\nAndroid operating system. However, Android support in Node.js\n[is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#android).","summary":"The `process.platform` property returns a string identifying the operating system platform for which the Node.js binary was compiled.","examples":[{"language":"mjs","displayName":null,"code":"import { platform } from 'node:process';\n\nconsole.log(`This platform is ${platform}`);"},{"language":"cjs","displayName":null,"code":"const { platform } = require('node:process');\n\nconsole.log(`This platform is ${platform}`);"}],"children":[]},{"kind":"property","id":"processppid","name":"ppid","title":"`process.ppid`","scope":"global","overloadOf":null,"stability":null,"added":["v9.2.0","v8.10.0","v6.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"default":null,"description":"The `process.ppid` property returns the PID of the parent of the\ncurrent process.\n\n```mjs\nimport { ppid } from 'node:process';\n\nconsole.log(`The parent process is pid ${ppid}`);\n```\n\n```cjs\nconst { ppid } = require('node:process');\n\nconsole.log(`The parent process is pid ${ppid}`);\n```","summary":"The `process.ppid` property returns the PID of the parent of the current process.","examples":[{"language":"mjs","displayName":null,"code":"import { ppid } from 'node:process';\n\nconsole.log(`The parent process is pid ${ppid}`);"},{"language":"cjs","displayName":null,"code":"const { ppid } = require('node:process');\n\nconsole.log(`The parent process is pid ${ppid}`);"}],"children":[]},{"kind":"method","id":"processrefmayberefable","name":"ref","title":"`process.ref(maybeRefable)`","scope":"global","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.6.0","v22.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"maybeRefable","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"An object that may be \"refable\".","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"An object is \"refable\" if it implements the Node.js \"Refable protocol\".\nSpecifically, this means that the object implements the `Symbol.for('nodejs.ref')`\nand `Symbol.for('nodejs.unref')` methods. \"Ref'd\" objects will keep the Node.js\nevent loop alive, while \"unref'd\" objects will not. Historically, this was\nimplemented by using `ref()` and `unref()` methods directly on the objects.\nThis pattern, however, is being deprecated in favor of the \"Refable protocol\"\nin order to better support Web Platform API types whose APIs cannot be modified\nto add `ref()` and `unref()` methods but still need to support that behavior.","summary":"An object is \"refable\" if it implements the Node.js \"Refable protocol\". Specifically, this means that the object implements the `Symbol.for('nodejs.ref')` and `Symbol.for('nodejs.unref')` methods. \"Ref'd\" objects will keep the Node.js event loop alive, while \"unref'd\" objects will not. Historically, this was implemented by using `ref()` and `unref()` methods directly on the objects. This pattern, however, is being deprecated in favor of the \"Refable protocol\" in order to better support Web Platform API types whose APIs cannot be modified to add `ref()` and `unref()` methods but still need to support that behavior.","examples":[],"children":[]},{"kind":"property","id":"processrelease","name":"release","title":"`process.release`","scope":"global","overloadOf":null,"stability":null,"added":["v3.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v4.2.0"],"prUrl":"https://github.com/nodejs/node/pull/3212","commit":null,"description":"The `lts` property is now supported."}],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"The `process.release` property returns an `Object` containing metadata related\nto the current release, including URLs for the source tarball and headers-only\ntarball.\n\n`process.release` contains the following properties:\n\n* `name` {string} A value that will always be `'node'`.\n* `sourceUrl` {string} an absolute URL pointing to a *`.tar.gz`* file containing\n  the source code of the current release.\n* `headersUrl`{string} an absolute URL pointing to a *`.tar.gz`* file containing\n  only the source header files for the current release. This file is\n  significantly smaller than the full source file and can be used for compiling\n  Node.js native add-ons.\n* `libUrl` {string | undefined} an absolute URL pointing to a *`node.lib`* file\n  matching the architecture and version of the current release. This file is\n  used for compiling Node.js native add-ons. *This property is only present on\n  Windows builds of Node.js and will be missing on all other platforms.*\n* `lts` {string | undefined} a string label identifying the [LTS](https://github.com/nodejs/Release) label for this\n  release. This property only exists for LTS releases and is `undefined` for all\n  other release types, including *Current* releases. Valid values include the\n  LTS Release code names (including those that are no longer supported).\n  * `'Fermium'` for the 14.x LTS line beginning with 14.15.0.\n  * `'Gallium'` for the 16.x LTS line beginning with 16.13.0.\n  * `'Hydrogen'` for the 18.x LTS line beginning with 18.12.0.\n    For other LTS Release code names, see [Node.js Changelog Archive](https://github.com/nodejs/node/blob/HEAD/doc/changelogs/CHANGELOG_ARCHIVE.md)\n\n```json\n{\n  \"name\": \"node\",\n  \"lts\": \"Hydrogen\",\n  \"sourceUrl\": \"https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz\",\n  \"headersUrl\": \"https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz\",\n  \"libUrl\": \"https://nodejs.org/download/release/v18.12.0/win-x64/node.lib\"\n}\n```\n\nIn custom builds from non-release versions of the source tree, only the\n`name` property may be present. The additional properties should not be\nrelied upon to exist.","summary":"The `process.release` property returns an `Object` containing metadata related to the current release, including URLs for the source tarball and headers-only tarball.","examples":[{"language":"json","displayName":null,"code":"{\n  \"name\": \"node\",\n  \"lts\": \"Hydrogen\",\n  \"sourceUrl\": \"https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz\",\n  \"headersUrl\": \"https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz\",\n  \"libUrl\": \"https://nodejs.org/download/release/v18.12.0/win-x64/node.lib\"\n}"}],"children":[]},{"kind":"property","id":"processreport","name":"report","title":"`process.report`","scope":"global","overloadOf":null,"stability":null,"added":["v11.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.12.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/32242","commit":null,"description":"This API is no longer experimental."}],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"`process.report` is an object whose methods are used to generate diagnostic\nreports for the current process. Additional documentation is available in the\n[report documentation](report.html).","summary":"`process.report` is an object whose methods are used to generate diagnostic reports for the current process. Additional documentation is available in the report documentation.","examples":[],"children":[{"kind":"property","id":"processreportcompact","name":"compact","title":"`process.report.compact`","scope":"global","overloadOf":null,"stability":null,"added":["v13.12.0","v12.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"Write reports in a compact format, single-line JSON, more easily consumable\nby log processing systems than the default multi-line format designed for\nhuman consumption.\n\n```mjs\nimport { report } from 'node:process';\n\nconsole.log(`Reports are compact? ${report.compact}`);\n```\n\n```cjs\nconst { report } = require('node:process');\n\nconsole.log(`Reports are compact? ${report.compact}`);\n```","summary":"Write reports in a compact format, single-line JSON, more easily consumable by log processing systems than the default multi-line format designed for human consumption.","examples":[{"language":"mjs","displayName":null,"code":"import { report } from 'node:process';\n\nconsole.log(`Reports are compact? ${report.compact}`);"},{"language":"cjs","displayName":null,"code":"const { report } = require('node:process');\n\nconsole.log(`Reports are compact? ${report.compact}`);"}],"children":[]},{"kind":"property","id":"processreportdirectory","name":"directory","title":"`process.report.directory`","scope":"global","overloadOf":null,"stability":null,"added":["v11.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.12.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/32242","commit":null,"description":"This API is no longer experimental."}],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"Directory where the report is written. The default value is the empty string,\nindicating that reports are written to the current working directory of the\nNode.js process.\n\n```mjs\nimport { report } from 'node:process';\n\nconsole.log(`Report directory is ${report.directory}`);\n```\n\n```cjs\nconst { report } = require('node:process');\n\nconsole.log(`Report directory is ${report.directory}`);\n```","summary":"Directory where the report is written. The default value is the empty string, indicating that reports are written to the current working directory of the Node.js process.","examples":[{"language":"mjs","displayName":null,"code":"import { report } from 'node:process';\n\nconsole.log(`Report directory is ${report.directory}`);"},{"language":"cjs","displayName":null,"code":"const { report } = require('node:process');\n\nconsole.log(`Report directory is ${report.directory}`);"}],"children":[]},{"kind":"property","id":"processreportfilename","name":"filename","title":"`process.report.filename`","scope":"global","overloadOf":null,"stability":null,"added":["v11.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.12.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/32242","commit":null,"description":"This API is no longer experimental."}],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"Filename where the report is written. If set to the empty string, the output\nfilename will be comprised of a timestamp, PID, and sequence number. The default\nvalue is the empty string.\n\nIf the value of `process.report.filename` is set to `'stdout'` or `'stderr'`,\nthe report is written to the stdout or stderr of the process respectively.\n\n```mjs\nimport { report } from 'node:process';\n\nconsole.log(`Report filename is ${report.filename}`);\n```\n\n```cjs\nconst { report } = require('node:process');\n\nconsole.log(`Report filename is ${report.filename}`);\n```","summary":"Filename where the report is written. If set to the empty string, the output filename will be comprised of a timestamp, PID, and sequence number. The default value is the empty string.","examples":[{"language":"mjs","displayName":null,"code":"import { report } from 'node:process';\n\nconsole.log(`Report filename is ${report.filename}`);"},{"language":"cjs","displayName":null,"code":"const { report } = require('node:process');\n\nconsole.log(`Report filename is ${report.filename}`);"}],"children":[]},{"kind":"method","id":"processreportgetreporterr","name":"getReport","title":"`process.report.getReport([err])`","scope":"global","overloadOf":null,"stability":null,"added":["v11.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.12.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/32242","commit":null,"description":"This API is no longer experimental."}],"signature":{"parameters":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"A custom error used for reporting the JavaScript stack.","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"Returns a JavaScript Object representation of a diagnostic report for the\nrunning process. The report's JavaScript stack trace is taken from `err`, if\npresent.\n\n```mjs\nimport { report } from 'node:process';\nimport util from 'node:util';\n\nconst data = report.getReport();\nconsole.log(data.header.nodejsVersion);\n\n// Similar to process.report.writeReport()\nimport fs from 'node:fs';\nfs.writeFileSync('my-report.log', util.inspect(data), 'utf8');\n```\n\n```cjs\nconst { report } = require('node:process');\nconst util = require('node:util');\n\nconst data = report.getReport();\nconsole.log(data.header.nodejsVersion);\n\n// Similar to process.report.writeReport()\nconst fs = require('node:fs');\nfs.writeFileSync('my-report.log', util.inspect(data), 'utf8');\n```\n\nAdditional documentation is available in the [report documentation](report.html).","summary":"Returns a JavaScript Object representation of a diagnostic report for the running process. The report's JavaScript stack trace is taken from `err`, if present.","examples":[{"language":"mjs","displayName":null,"code":"import { report } from 'node:process';\nimport util from 'node:util';\n\nconst data = report.getReport();\nconsole.log(data.header.nodejsVersion);\n\n// Similar to process.report.writeReport()\nimport fs from 'node:fs';\nfs.writeFileSync('my-report.log', util.inspect(data), 'utf8');"},{"language":"cjs","displayName":null,"code":"const { report } = require('node:process');\nconst util = require('node:util');\n\nconst data = report.getReport();\nconsole.log(data.header.nodejsVersion);\n\n// Similar to process.report.writeReport()\nconst fs = require('node:fs');\nfs.writeFileSync('my-report.log', util.inspect(data), 'utf8');"}],"children":[]},{"kind":"property","id":"processreportreportonfatalerror","name":"reportOnFatalError","title":"`process.report.reportOnFatalError`","scope":"global","overloadOf":null,"stability":null,"added":["v11.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v15.0.0","v14.17.0"],"prUrl":"https://github.com/nodejs/node/pull/35654","commit":null,"description":"This API is no longer experimental."}],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"If `true`, a diagnostic report is generated on fatal errors, such as out of\nmemory errors or failed C++ assertions.\n\n```mjs\nimport { report } from 'node:process';\n\nconsole.log(`Report on fatal error: ${report.reportOnFatalError}`);\n```\n\n```cjs\nconst { report } = require('node:process');\n\nconsole.log(`Report on fatal error: ${report.reportOnFatalError}`);\n```","summary":"If `true`, a diagnostic report is generated on fatal errors, such as out of memory errors or failed C++ assertions.","examples":[{"language":"mjs","displayName":null,"code":"import { report } from 'node:process';\n\nconsole.log(`Report on fatal error: ${report.reportOnFatalError}`);"},{"language":"cjs","displayName":null,"code":"const { report } = require('node:process');\n\nconsole.log(`Report on fatal error: ${report.reportOnFatalError}`);"}],"children":[]},{"kind":"property","id":"processreportreportonsignal","name":"reportOnSignal","title":"`process.report.reportOnSignal`","scope":"global","overloadOf":null,"stability":null,"added":["v11.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.12.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/32242","commit":null,"description":"This API is no longer experimental."}],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"If `true`, a diagnostic report is generated when the process receives the\nsignal specified by `process.report.signal`.\n\n```mjs\nimport { report } from 'node:process';\n\nconsole.log(`Report on signal: ${report.reportOnSignal}`);\n```\n\n```cjs\nconst { report } = require('node:process');\n\nconsole.log(`Report on signal: ${report.reportOnSignal}`);\n```","summary":"If `true`, a diagnostic report is generated when the process receives the signal specified by `process.report.signal`.","examples":[{"language":"mjs","displayName":null,"code":"import { report } from 'node:process';\n\nconsole.log(`Report on signal: ${report.reportOnSignal}`);"},{"language":"cjs","displayName":null,"code":"const { report } = require('node:process');\n\nconsole.log(`Report on signal: ${report.reportOnSignal}`);"}],"children":[]},{"kind":"property","id":"processreportreportonuncaughtexception","name":"reportOnUncaughtException","title":"`process.report.reportOnUncaughtException`","scope":"global","overloadOf":null,"stability":null,"added":["v11.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.12.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/32242","commit":null,"description":"This API is no longer experimental."}],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"If `true`, a diagnostic report is generated on uncaught exception.\n\n```mjs\nimport { report } from 'node:process';\n\nconsole.log(`Report on exception: ${report.reportOnUncaughtException}`);\n```\n\n```cjs\nconst { report } = require('node:process');\n\nconsole.log(`Report on exception: ${report.reportOnUncaughtException}`);\n```","summary":"If `true`, a diagnostic report is generated on uncaught exception.","examples":[{"language":"mjs","displayName":null,"code":"import { report } from 'node:process';\n\nconsole.log(`Report on exception: ${report.reportOnUncaughtException}`);"},{"language":"cjs","displayName":null,"code":"const { report } = require('node:process');\n\nconsole.log(`Report on exception: ${report.reportOnUncaughtException}`);"}],"children":[]},{"kind":"property","id":"processreportexcludeenv","name":"excludeEnv","title":"`process.report.excludeEnv`","scope":"global","overloadOf":null,"stability":null,"added":["v23.3.0","v22.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"If `true`, a diagnostic report is generated without the environment variables.","summary":"If `true`, a diagnostic report is generated without the environment variables.","examples":[],"children":[]},{"kind":"property","id":"processreportsignal","name":"signal","title":"`process.report.signal`","scope":"global","overloadOf":null,"stability":null,"added":["v11.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.12.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/32242","commit":null,"description":"This API is no longer experimental."}],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The signal used to trigger the creation of a diagnostic report. Defaults to\n`'SIGUSR2'`.\n\n```mjs\nimport { report } from 'node:process';\n\nconsole.log(`Report signal: ${report.signal}`);\n```\n\n```cjs\nconst { report } = require('node:process');\n\nconsole.log(`Report signal: ${report.signal}`);\n```","summary":"The signal used to trigger the creation of a diagnostic report. Defaults to `'SIGUSR2'`.","examples":[{"language":"mjs","displayName":null,"code":"import { report } from 'node:process';\n\nconsole.log(`Report signal: ${report.signal}`);"},{"language":"cjs","displayName":null,"code":"const { report } = require('node:process');\n\nconsole.log(`Report signal: ${report.signal}`);"}],"children":[]},{"kind":"method","id":"processreportwritereportfilename-err","name":"writeReport","title":"`process.report.writeReport([filename][, err])`","scope":"global","overloadOf":null,"stability":null,"added":["v11.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.12.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/32242","commit":null,"description":"This API is no longer experimental."}],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Name of the file where the report is written. This\nshould be a relative path, that will be appended to the directory specified in\n`process.report.directory`, or the current working directory of the Node.js\nprocess, if unspecified.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"A custom error used for reporting the JavaScript stack.","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Returns the filename of the generated report."}},"description":"Writes a diagnostic report to a file. If `filename` is not provided, the default\nfilename includes the date, time, PID, and a sequence number. The report's\nJavaScript stack trace is taken from `err`, if present.\n\nIf the value of `filename` is set to `'stdout'` or `'stderr'`, the report is\nwritten to the stdout or stderr of the process respectively.\n\n```mjs\nimport { report } from 'node:process';\n\nreport.writeReport();\n```\n\n```cjs\nconst { report } = require('node:process');\n\nreport.writeReport();\n```\n\nAdditional documentation is available in the [report documentation](report.html).","summary":"Writes a diagnostic report to a file. If `filename` is not provided, the default filename includes the date, time, PID, and a sequence number. The report's JavaScript stack trace is taken from `err`, if present.","examples":[{"language":"mjs","displayName":null,"code":"import { report } from 'node:process';\n\nreport.writeReport();"},{"language":"cjs","displayName":null,"code":"const { report } = require('node:process');\n\nreport.writeReport();"}],"children":[]}]},{"kind":"method","id":"processresourceusage","name":"resourceUsage","title":"`process.resourceUsage()`","scope":"global","overloadOf":null,"stability":null,"added":["v12.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"the resource usage for the current process. All of these\nvalues come from the `uv_getrusage` call which returns\na [`uv_rusage_t` struct](https://docs.libuv.org/en/v1.x/misc.html#c.uv_rusage_t)."}},"description":"```mjs\nimport { resourceUsage } from 'node:process';\n\nconsole.log(resourceUsage());\n/*\n  Will output:\n  {\n    userCPUTime: 82872,\n    systemCPUTime: 4143,\n    maxRSS: 33164,\n    sharedMemorySize: 0,\n    unsharedDataSize: 0,\n    unsharedStackSize: 0,\n    minorPageFault: 2469,\n    majorPageFault: 0,\n    swappedOut: 0,\n    fsRead: 0,\n    fsWrite: 8,\n    ipcSent: 0,\n    ipcReceived: 0,\n    signalsCount: 0,\n    voluntaryContextSwitches: 79,\n    involuntaryContextSwitches: 1\n  }\n*/\n```\n\n```cjs\nconst { resourceUsage } = require('node:process');\n\nconsole.log(resourceUsage());\n/*\n  Will output:\n  {\n    userCPUTime: 82872,\n    systemCPUTime: 4143,\n    maxRSS: 33164,\n    sharedMemorySize: 0,\n    unsharedDataSize: 0,\n    unsharedStackSize: 0,\n    minorPageFault: 2469,\n    majorPageFault: 0,\n    swappedOut: 0,\n    fsRead: 0,\n    fsWrite: 8,\n    ipcSent: 0,\n    ipcReceived: 0,\n    signalsCount: 0,\n    voluntaryContextSwitches: 79,\n    involuntaryContextSwitches: 1\n  }\n*/\n```","summary":"","examples":[{"language":"mjs","displayName":null,"code":"import { resourceUsage } from 'node:process';\n\nconsole.log(resourceUsage());\n/*\n  Will output:\n  {\n    userCPUTime: 82872,\n    systemCPUTime: 4143,\n    maxRSS: 33164,\n    sharedMemorySize: 0,\n    unsharedDataSize: 0,\n    unsharedStackSize: 0,\n    minorPageFault: 2469,\n    majorPageFault: 0,\n    swappedOut: 0,\n    fsRead: 0,\n    fsWrite: 8,\n    ipcSent: 0,\n    ipcReceived: 0,\n    signalsCount: 0,\n    voluntaryContextSwitches: 79,\n    involuntaryContextSwitches: 1\n  }\n*/"},{"language":"cjs","displayName":null,"code":"const { resourceUsage } = require('node:process');\n\nconsole.log(resourceUsage());\n/*\n  Will output:\n  {\n    userCPUTime: 82872,\n    systemCPUTime: 4143,\n    maxRSS: 33164,\n    sharedMemorySize: 0,\n    unsharedDataSize: 0,\n    unsharedStackSize: 0,\n    minorPageFault: 2469,\n    majorPageFault: 0,\n    swappedOut: 0,\n    fsRead: 0,\n    fsWrite: 8,\n    ipcSent: 0,\n    ipcReceived: 0,\n    signalsCount: 0,\n    voluntaryContextSwitches: 79,\n    involuntaryContextSwitches: 1\n  }\n*/"}],"children":[]},{"kind":"method","id":"processsendmessage-sendhandle-options-callback","name":"send","title":"`process.send(message[, sendHandle[, options]][, callback])`","scope":"global","overloadOf":null,"stability":null,"added":["v0.5.9"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"message","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"sendHandle","type":{"text":"net.Server | net.Socket","links":[{"name":"net.Server","href":"net.html#class-netserver","start":0,"end":10},{"name":"net.Socket","href":"net.html#class-netsocket","start":13,"end":23}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"used to parameterize the sending of certain types of\nhandles.`options` supports the following properties:","default":null,"optional":true,"rest":false,"properties":[{"name":"keepOpen","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"A value that can be used when passing instances of\n`net.Socket`. When `true`, the socket is kept open in the sending process.","default":"false","optional":true,"rest":false,"properties":[]}]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"If Node.js is spawned with an IPC channel, the `process.send()` method can be\nused to send messages to the parent process. Messages will be received as a\n[`'message'`](child_process.html#event-message) event on the parent's [`ChildProcess`](child_process.html#class-childprocess) object.\n\nIf Node.js was not spawned with an IPC channel, `process.send` will be\n`undefined`.\n\nThe message goes through serialization and parsing. The resulting message might\nnot be the same as what is originally sent.","summary":"If Node.js is spawned with an IPC channel, the `process.send()` method can be used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.","examples":[],"children":[]},{"kind":"method","id":"processsetegidid","name":"setegid","title":"`process.setegid(id)`","scope":"global","overloadOf":null,"stability":null,"added":["v2.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"id","type":{"text":"string | number","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":9,"end":15}]},"description":"A group name or ID","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The `process.setegid()` method sets the effective group identity of the process.\n(See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group\nname string. If a group name is specified, this method blocks while resolving\nthe associated a numeric ID.\n\n```mjs\nimport process from 'node:process';\n\nif (process.getegid && process.setegid) {\n  console.log(`Current gid: ${process.getegid()}`);\n  try {\n    process.setegid(501);\n    console.log(`New gid: ${process.getegid()}`);\n  } catch (err) {\n    console.error(`Failed to set gid: ${err}`);\n  }\n}\n```\n\n```cjs\nif (process.getegid && process.setegid) {\n  console.log(`Current gid: ${process.getegid()}`);\n  try {\n    process.setegid(501);\n    console.log(`New gid: ${process.getegid()}`);\n  } catch (err) {\n    console.error(`Failed to set gid: ${err}`);\n  }\n}\n```\n\nThis function is only available on POSIX platforms (i.e. not Windows or\nAndroid).\nThis feature is not available in [`Worker`](worker_threads.html#class-worker) threads.","summary":"The `process.setegid()` method sets the effective group identity of the process. (See `setegid(2)`.) The `id` can be passed as either a numeric ID or a group name string. If a group name is specified, this method blocks while resolving the associated a numeric ID.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nif (process.getegid && process.setegid) {\n  console.log(`Current gid: ${process.getegid()}`);\n  try {\n    process.setegid(501);\n    console.log(`New gid: ${process.getegid()}`);\n  } catch (err) {\n    console.error(`Failed to set gid: ${err}`);\n  }\n}"},{"language":"cjs","displayName":null,"code":"if (process.getegid && process.setegid) {\n  console.log(`Current gid: ${process.getegid()}`);\n  try {\n    process.setegid(501);\n    console.log(`New gid: ${process.getegid()}`);\n  } catch (err) {\n    console.error(`Failed to set gid: ${err}`);\n  }\n}"}],"children":[]},{"kind":"method","id":"processseteuidid","name":"seteuid","title":"`process.seteuid(id)`","scope":"global","overloadOf":null,"stability":null,"added":["v2.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"id","type":{"text":"string | number","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":9,"end":15}]},"description":"A user name or ID","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The `process.seteuid()` method sets the effective user identity of the process.\n(See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username\nstring. If a username is specified, the method blocks while resolving the\nassociated numeric ID.\n\n```mjs\nimport process from 'node:process';\n\nif (process.geteuid && process.seteuid) {\n  console.log(`Current uid: ${process.geteuid()}`);\n  try {\n    process.seteuid(501);\n    console.log(`New uid: ${process.geteuid()}`);\n  } catch (err) {\n    console.error(`Failed to set uid: ${err}`);\n  }\n}\n```\n\n```cjs\nif (process.geteuid && process.seteuid) {\n  console.log(`Current uid: ${process.geteuid()}`);\n  try {\n    process.seteuid(501);\n    console.log(`New uid: ${process.geteuid()}`);\n  } catch (err) {\n    console.error(`Failed to set uid: ${err}`);\n  }\n}\n```\n\nThis function is only available on POSIX platforms (i.e. not Windows or\nAndroid).\nThis feature is not available in [`Worker`](worker_threads.html#class-worker) threads.","summary":"The `process.seteuid()` method sets the effective user identity of the process. (See `seteuid(2)`.) The `id` can be passed as either a numeric ID or a username string. If a username is specified, the method blocks while resolving the associated numeric ID.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nif (process.geteuid && process.seteuid) {\n  console.log(`Current uid: ${process.geteuid()}`);\n  try {\n    process.seteuid(501);\n    console.log(`New uid: ${process.geteuid()}`);\n  } catch (err) {\n    console.error(`Failed to set uid: ${err}`);\n  }\n}"},{"language":"cjs","displayName":null,"code":"if (process.geteuid && process.seteuid) {\n  console.log(`Current uid: ${process.geteuid()}`);\n  try {\n    process.seteuid(501);\n    console.log(`New uid: ${process.geteuid()}`);\n  } catch (err) {\n    console.error(`Failed to set uid: ${err}`);\n  }\n}"}],"children":[]},{"kind":"method","id":"processsetgidid","name":"setgid","title":"`process.setgid(id)`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.31"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"id","type":{"text":"string | number","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":9,"end":15}]},"description":"The group name or ID","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The `process.setgid()` method sets the group identity of the process. (See\n[`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a numeric ID or a group name\nstring. If a group name is specified, this method blocks while resolving the\nassociated numeric ID.\n\n```mjs\nimport process from 'node:process';\n\nif (process.getgid && process.setgid) {\n  console.log(`Current gid: ${process.getgid()}`);\n  try {\n    process.setgid(501);\n    console.log(`New gid: ${process.getgid()}`);\n  } catch (err) {\n    console.error(`Failed to set gid: ${err}`);\n  }\n}\n```\n\n```cjs\nif (process.getgid && process.setgid) {\n  console.log(`Current gid: ${process.getgid()}`);\n  try {\n    process.setgid(501);\n    console.log(`New gid: ${process.getgid()}`);\n  } catch (err) {\n    console.error(`Failed to set gid: ${err}`);\n  }\n}\n```\n\nThis function is only available on POSIX platforms (i.e. not Windows or\nAndroid).\nThis feature is not available in [`Worker`](worker_threads.html#class-worker) threads.","summary":"The `process.setgid()` method sets the group identity of the process. (See `setgid(2)`.) The `id` can be passed as either a numeric ID or a group name string. If a group name is specified, this method blocks while resolving the associated numeric ID.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nif (process.getgid && process.setgid) {\n  console.log(`Current gid: ${process.getgid()}`);\n  try {\n    process.setgid(501);\n    console.log(`New gid: ${process.getgid()}`);\n  } catch (err) {\n    console.error(`Failed to set gid: ${err}`);\n  }\n}"},{"language":"cjs","displayName":null,"code":"if (process.getgid && process.setgid) {\n  console.log(`Current gid: ${process.getgid()}`);\n  try {\n    process.setgid(501);\n    console.log(`New gid: ${process.getgid()}`);\n  } catch (err) {\n    console.error(`Failed to set gid: ${err}`);\n  }\n}"}],"children":[]},{"kind":"method","id":"processsetgroupsgroups","name":"setgroups","title":"`process.setgroups(groups)`","scope":"global","overloadOf":null,"stability":null,"added":["v0.9.4"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"groups","type":{"text":"integer[]","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The `process.setgroups()` method sets the supplementary group IDs for the\nNode.js process. This is a privileged operation that requires the Node.js\nprocess to have `root` or the `CAP_SETGID` capability.\n\nThe `groups` array can contain numeric group IDs, group names, or both.\n\n```mjs\nimport process from 'node:process';\n\nif (process.getgroups && process.setgroups) {\n  try {\n    process.setgroups([501]);\n    console.log(process.getgroups()); // new groups\n  } catch (err) {\n    console.error(`Failed to set groups: ${err}`);\n  }\n}\n```\n\n```cjs\nif (process.getgroups && process.setgroups) {\n  try {\n    process.setgroups([501]);\n    console.log(process.getgroups()); // new groups\n  } catch (err) {\n    console.error(`Failed to set groups: ${err}`);\n  }\n}\n```\n\nThis function is only available on POSIX platforms (i.e. not Windows or\nAndroid).\nThis feature is not available in [`Worker`](worker_threads.html#class-worker) threads.","summary":"The `process.setgroups()` method sets the supplementary group IDs for the Node.js process. This is a privileged operation that requires the Node.js process to have `root` or the `CAP_SETGID` capability.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nif (process.getgroups && process.setgroups) {\n  try {\n    process.setgroups([501]);\n    console.log(process.getgroups()); // new groups\n  } catch (err) {\n    console.error(`Failed to set groups: ${err}`);\n  }\n}"},{"language":"cjs","displayName":null,"code":"if (process.getgroups && process.setgroups) {\n  try {\n    process.setgroups([501]);\n    console.log(process.getgroups()); // new groups\n  } catch (err) {\n    console.error(`Failed to set groups: ${err}`);\n  }\n}"}],"children":[]},{"kind":"method","id":"processsetuidid","name":"setuid","title":"`process.setuid(id)`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.28"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"id","type":{"text":"integer | string","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":10,"end":16}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The `process.setuid(id)` method sets the user identity of the process. (See\n[`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a numeric ID or a username string.\nIf a username is specified, the method blocks while resolving the associated\nnumeric ID.\n\n```mjs\nimport process from 'node:process';\n\nif (process.getuid && process.setuid) {\n  console.log(`Current uid: ${process.getuid()}`);\n  try {\n    process.setuid(501);\n    console.log(`New uid: ${process.getuid()}`);\n  } catch (err) {\n    console.error(`Failed to set uid: ${err}`);\n  }\n}\n```\n\n```cjs\nif (process.getuid && process.setuid) {\n  console.log(`Current uid: ${process.getuid()}`);\n  try {\n    process.setuid(501);\n    console.log(`New uid: ${process.getuid()}`);\n  } catch (err) {\n    console.error(`Failed to set uid: ${err}`);\n  }\n}\n```\n\nThis function is only available on POSIX platforms (i.e. not Windows or\nAndroid).\nThis feature is not available in [`Worker`](worker_threads.html#class-worker) threads.","summary":"The `process.setuid(id)` method sets the user identity of the process. (See `setuid(2)`.) The `id` can be passed as either a numeric ID or a username string. If a username is specified, the method blocks while resolving the associated numeric ID.","examples":[{"language":"mjs","displayName":null,"code":"import process from 'node:process';\n\nif (process.getuid && process.setuid) {\n  console.log(`Current uid: ${process.getuid()}`);\n  try {\n    process.setuid(501);\n    console.log(`New uid: ${process.getuid()}`);\n  } catch (err) {\n    console.error(`Failed to set uid: ${err}`);\n  }\n}"},{"language":"cjs","displayName":null,"code":"if (process.getuid && process.setuid) {\n  console.log(`Current uid: ${process.getuid()}`);\n  try {\n    process.setuid(501);\n    console.log(`New uid: ${process.getuid()}`);\n  } catch (err) {\n    console.error(`Failed to set uid: ${err}`);\n  }\n}"}],"children":[]},{"kind":"method","id":"processsetsourcemapsenabledval","name":"setSourceMapsEnabled","title":"`process.setSourceMapsEnabled(val)`","scope":"global","overloadOf":null,"stability":{"index":"1","description":"Experimental: Use [`module.setSourceMapsSupport()`](module.html#modulesetsourcemapssupportenabled-options) instead."},"added":["v16.6.0","v14.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"val","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"This function enables or disables the [Source Map](https://tc39.es/ecma426/) support for\nstack traces.\n\nIt provides same features as launching Node.js process with commandline options\n`--enable-source-maps`.\n\nOnly source maps in JavaScript files that are loaded after source maps has been\nenabled will be parsed and loaded.\n\nThis implies calling `module.setSourceMapsSupport()` with an option\n`{ nodeModules: true, generatedCode: true }`.","summary":"This function enables or disables the Source Map support for stack traces.","examples":[],"children":[]},{"kind":"method","id":"processsetuncaughtexceptioncapturecallbackfn","name":"setUncaughtExceptionCaptureCallback","title":"`process.setUncaughtExceptionCaptureCallback(fn)`","scope":"global","overloadOf":null,"stability":null,"added":["v9.3.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v25.9.0"],"prUrl":"https://github.com/nodejs/node/pull/61227","commit":null,"description":"Use `process.addUncaughtExceptionCaptureCallback()` to register multiple callbacks."}],"signature":{"parameters":[{"name":"fn","type":{"text":"Function | null","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8},{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":11,"end":15}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The `process.setUncaughtExceptionCaptureCallback()` function sets a function\nthat will be invoked when an uncaught exception occurs, which will receive the\nexception value itself as its first argument.\n\nIf such a function is set, the [`'uncaughtException'`](#event-uncaughtexception) event will\nnot be emitted. If `--abort-on-uncaught-exception` was passed from the\ncommand line or set through [`v8.setFlagsFromString()`](v8.html#v8setflagsfromstringflags), the process will\nnot abort. Actions configured to take place on exceptions such as report\ngenerations will be affected too\n\nTo unset the capture function,\n`process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this\nmethod with a non-`null` argument while another capture function is set will\nthrow an error.\n\nTo register multiple callbacks that can coexist, use\n[`process.addUncaughtExceptionCaptureCallback()`](#processadduncaughtexceptioncapturecallbackfn) instead.","summary":"The `process.setUncaughtExceptionCaptureCallback()` function sets a function that will be invoked when an uncaught exception occurs, which will receive the exception value itself as its first argument.","examples":[],"children":[]},{"kind":"property","id":"processsourcemapsenabled","name":"sourceMapsEnabled","title":"`process.sourceMapsEnabled`","scope":"global","overloadOf":null,"stability":{"index":"1","description":"Experimental: Use [`module.getSourceMapsSupport()`](module.html#modulegetsourcemapssupport) instead."},"added":["v20.7.0","v18.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"The `process.sourceMapsEnabled` property returns whether the\n[Source Map](https://tc39.es/ecma426/) support for stack traces is enabled.","summary":"The `process.sourceMapsEnabled` property returns whether the Source Map support for stack traces is enabled.","examples":[],"children":[]},{"kind":"property","id":"processstderr","name":"stderr","title":"`process.stderr`","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Stream","links":[{"name":"Stream","href":"stream.html#stream","start":0,"end":6}]},"default":null,"description":"The `process.stderr` property returns a stream connected to\n`stderr` (fd `2`). It is a [`net.Socket`](net.html#class-netsocket) (which is a [Duplex](stream.html#duplex-and-transform-streams)\nstream) unless fd `2` refers to a file, in which case it is\na [Writable](stream.html#writable-streams) stream.\n\n`process.stderr` differs from other Node.js streams in important ways. See\n[note on process I/O](#a-note-on-process-io) for more information.","summary":"The `process.stderr` property returns a stream connected to `stderr` (fd `2`). It is a `net.Socket` (which is a Duplex stream) unless fd `2` refers to a file, in which case it is a Writable stream.","examples":[],"children":[{"kind":"property","id":"processstderrfd","name":"fd","title":"`process.stderr.fd`","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"This property refers to the value of underlying file descriptor of\n`process.stderr`. The value is fixed at `2`. In [`Worker`](worker_threads.html#class-worker) threads,\nthis field does not exist.","summary":"This property refers to the value of underlying file descriptor of `process.stderr`. The value is fixed at `2`. In `Worker` threads, this field does not exist.","examples":[],"children":[]}]},{"kind":"property","id":"processstdin","name":"stdin","title":"`process.stdin`","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Stream","links":[{"name":"Stream","href":"stream.html#stream","start":0,"end":6}]},"default":null,"description":"The `process.stdin` property returns a stream connected to\n`stdin` (fd `0`). It is a [`net.Socket`](net.html#class-netsocket) (which is a [Duplex](stream.html#duplex-and-transform-streams)\nstream) unless fd `0` refers to a file, in which case it is\na [Readable](stream.html#readable-streams) stream.\n\nFor details of how to read from `stdin` see [`readable.read()`](stream.html#readablereadsize).\n\nAs a [Duplex](stream.html#duplex-and-transform-streams) stream, `process.stdin` can also be used in \"old\" mode that\nis compatible with scripts written for Node.js prior to v0.10.\nFor more information see [Stream compatibility](stream.html#compatibility-with-older-nodejs-versions).\n\nIn \"old\" streams mode the `stdin` stream is paused by default, so one\nmust call `process.stdin.resume()` to read from it. Note also that calling\n`process.stdin.resume()` itself would switch stream to \"old\" mode.","summary":"The `process.stdin` property returns a stream connected to `stdin` (fd `0`). It is a `net.Socket` (which is a Duplex stream) unless fd `0` refers to a file, in which case it is a Readable stream.","examples":[],"children":[{"kind":"property","id":"processstdinfd","name":"fd","title":"`process.stdin.fd`","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"This property refers to the value of underlying file descriptor of\n`process.stdin`. The value is fixed at `0`. In [`Worker`](worker_threads.html#class-worker) threads,\nthis field does not exist.","summary":"This property refers to the value of underlying file descriptor of `process.stdin`. The value is fixed at `0`. In `Worker` threads, this field does not exist.","examples":[],"children":[]}]},{"kind":"property","id":"processstdout","name":"stdout","title":"`process.stdout`","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Stream","links":[{"name":"Stream","href":"stream.html#stream","start":0,"end":6}]},"default":null,"description":"The `process.stdout` property returns a stream connected to\n`stdout` (fd `1`). It is a [`net.Socket`](net.html#class-netsocket) (which is a [Duplex](stream.html#duplex-and-transform-streams)\nstream) unless fd `1` refers to a file, in which case it is\na [Writable](stream.html#writable-streams) stream.\n\nFor example, to copy `process.stdin` to `process.stdout`:\n\n```mjs\nimport { stdin, stdout } from 'node:process';\n\nstdin.pipe(stdout);\n```\n\n```cjs\nconst { stdin, stdout } = require('node:process');\n\nstdin.pipe(stdout);\n```\n\n`process.stdout` differs from other Node.js streams in important ways. See\n[note on process I/O](#a-note-on-process-io) for more information.","summary":"The `process.stdout` property returns a stream connected to `stdout` (fd `1`). It is a `net.Socket` (which is a Duplex stream) unless fd `1` refers to a file, in which case it is a Writable stream.","examples":[{"language":"mjs","displayName":null,"code":"import { stdin, stdout } from 'node:process';\n\nstdin.pipe(stdout);"},{"language":"cjs","displayName":null,"code":"const { stdin, stdout } = require('node:process');\n\nstdin.pipe(stdout);"}],"children":[{"kind":"property","id":"processstdoutfd","name":"fd","title":"`process.stdout.fd`","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"This property refers to the value of underlying file descriptor of\n`process.stdout`. The value is fixed at `1`. In [`Worker`](worker_threads.html#class-worker) threads,\nthis field does not exist.","summary":"This property refers to the value of underlying file descriptor of `process.stdout`. The value is fixed at `1`. In `Worker` threads, this field does not exist.","examples":[],"children":[]},{"kind":"section","id":"a-note-on-process-io","name":"A note on process I/O","title":"A note on process I/O","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"`process.stdout` and `process.stderr` differ from other Node.js streams in\nimportant ways:\n\n1. They are used internally by [`console.log()`](console.html#consolelogdata-args) and [`console.error()`](console.html#consoleerrordata-args),\n   respectively.\n2. Writes may be synchronous depending on what the stream is connected to\n   and whether the system is Windows or POSIX:\n   * Files: *synchronous* on Windows and POSIX\n   * TTYs (Terminals): *asynchronous* on Windows, *synchronous* on POSIX\n   * Pipes (and sockets): *synchronous* on Windows, *asynchronous* on POSIX\n\nThese behaviors are partly for historical reasons, as changing them would\ncreate backward incompatibility, but they are also expected by some users.\n\nSynchronous writes avoid problems such as output written with `console.log()` or\n`console.error()` being unexpectedly interleaved, or not written at all if\n`process.exit()` is called before an asynchronous write completes. See\n[`process.exit()`](#processexitcode) for more information.\n\n***Warning***: Synchronous writes block the event loop until the write has\ncompleted. This can be near instantaneous in the case of output to a file, but\nunder high system load, pipes that are not being read at the receiving end, or\nwith slow terminals or file systems, it's possible for the event loop to be\nblocked often enough and long enough to have severe negative performance\nimpacts. This may not be a problem when writing to an interactive terminal\nsession, but consider this particularly careful when doing production logging to\nthe process output streams.\n\nTo check if a stream is connected to a [TTY](tty.html#tty) context, check the `isTTY`\nproperty.\n\nFor instance:\n\n```console\n$ node -p \"Boolean(process.stdin.isTTY)\"\ntrue\n$ echo \"foo\" | node -p \"Boolean(process.stdin.isTTY)\"\nfalse\n$ node -p \"Boolean(process.stdout.isTTY)\"\ntrue\n$ node -p \"Boolean(process.stdout.isTTY)\" | cat\nfalse\n```\n\nSee the [TTY](tty.html#tty) documentation for more information.","summary":"`process.stdout` and `process.stderr` differ from other Node.js streams in important ways:","examples":[{"language":"console","displayName":null,"code":"$ node -p \"Boolean(process.stdin.isTTY)\"\ntrue\n$ echo \"foo\" | node -p \"Boolean(process.stdin.isTTY)\"\nfalse\n$ node -p \"Boolean(process.stdout.isTTY)\"\ntrue\n$ node -p \"Boolean(process.stdout.isTTY)\" | cat\nfalse"}],"children":[]}]},{"kind":"property","id":"processthrowdeprecation","name":"throwDeprecation","title":"`process.throwDeprecation`","scope":"global","overloadOf":null,"stability":null,"added":["v0.9.12"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"The initial value of `process.throwDeprecation` indicates whether the\n`--throw-deprecation` flag is set on the current Node.js process.\n`process.throwDeprecation` is mutable, so whether or not deprecation\nwarnings result in errors may be altered at runtime. See the\ndocumentation for the [`'warning'` event](#event-warning) and the\n[`emitWarning()` method](#processemitwarningwarning-type-code-ctor) for more information.\n\n```console\n$ node --throw-deprecation -p \"process.throwDeprecation\"\ntrue\n$ node -p \"process.throwDeprecation\"\nundefined\n$ node\n> process.emitWarning('test', 'DeprecationWarning');\nundefined\n> (node:26598) DeprecationWarning: test\n> process.throwDeprecation = true;\ntrue\n> process.emitWarning('test', 'DeprecationWarning');\nThrown:\n[DeprecationWarning: test] { name: 'DeprecationWarning' }\n```","summary":"The initial value of `process.throwDeprecation` indicates whether the `--throw-deprecation` flag is set on the current Node.js process. `process.throwDeprecation` is mutable, so whether or not deprecation warnings result in errors may be altered at runtime. See the documentation for the `'warning'` event and the `emitWarning()` method for more information.","examples":[{"language":"console","displayName":null,"code":"$ node --throw-deprecation -p \"process.throwDeprecation\"\ntrue\n$ node -p \"process.throwDeprecation\"\nundefined\n$ node\n> process.emitWarning('test', 'DeprecationWarning');\nundefined\n> (node:26598) DeprecationWarning: test\n> process.throwDeprecation = true;\ntrue\n> process.emitWarning('test', 'DeprecationWarning');\nThrown:\n[DeprecationWarning: test] { name: 'DeprecationWarning' }"}],"children":[]},{"kind":"method","id":"processthreadcpuusagepreviousvalue","name":"threadCpuUsage","title":"`process.threadCpuUsage([previousValue])`","scope":"global","overloadOf":null,"stability":null,"added":["v23.9.0","v22.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"previousValue","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"A previous return value from calling\n`process.threadCpuUsage()`","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"The `process.threadCpuUsage()` method returns the user and system CPU time usage of\nthe current worker thread, in an object with properties `user` and `system`, whose\nvalues are microsecond values (millionth of a second).\n\nThe result of a previous call to `process.threadCpuUsage()` can be passed as the\nargument to the function, to get a diff reading.","summary":"The `process.threadCpuUsage()` method returns the user and system CPU time usage of the current worker thread, in an object with properties `user` and `system`, whose values are microsecond values (millionth of a second).","examples":[],"children":[]},{"kind":"property","id":"processtitle","name":"title","title":"`process.title`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.104"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The `process.title` property returns the current process title (i.e. returns\nthe current value of `ps`). Assigning a new value to `process.title` modifies\nthe current value of `ps`.\n\nWhen a new value is assigned, different platforms will impose different maximum\nlength restrictions on the title. Usually such restrictions are quite limited.\nFor instance, on Linux and macOS, `process.title` is limited to the size of the\nbinary name plus the length of the command-line arguments because setting the\n`process.title` overwrites the `argv` memory of the process. Node.js 0.8\nallowed for longer process title strings by also overwriting the `environ`\nmemory but that was potentially insecure and confusing in some (rather obscure)\ncases.\n\nAssigning a value to `process.title` might not result in an accurate label\nwithin process manager applications such as macOS Activity Monitor or Windows\nServices Manager.","summary":"The `process.title` property returns the current process title (i.e. returns the current value of `ps`). Assigning a new value to `process.title` modifies the current value of `ps`.","examples":[],"children":[]},{"kind":"property","id":"processtracedeprecation","name":"traceDeprecation","title":"`process.traceDeprecation`","scope":"global","overloadOf":null,"stability":null,"added":["v0.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"The `process.traceDeprecation` property indicates whether the\n`--trace-deprecation` flag is set on the current Node.js process. See the\ndocumentation for the [`'warning'` event](#event-warning) and the\n[`emitWarning()` method](#processemitwarningwarning-type-code-ctor) for more information about this\nflag's behavior.","summary":"The `process.traceDeprecation` property indicates whether the `--trace-deprecation` flag is set on the current Node.js process. See the documentation for the `'warning'` event and the `emitWarning()` method for more information about this flag's behavior.","examples":[],"children":[]},{"kind":"property","id":"processtraceprocesswarnings","name":"traceProcessWarnings","title":"`process.traceProcessWarnings`","scope":"global","overloadOf":null,"stability":null,"added":["v6.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"The `process.traceProcessWarnings` property indicates whether the `--trace-warnings` flag\nis set on the current Node.js process. This property allows programmatic control over the\ntracing of warnings, enabling or disabling stack traces for warnings at runtime.\n\n```js\n// Enable trace warnings\nprocess.traceProcessWarnings = true;\n\n// Emit a warning with a stack trace\nprocess.emitWarning('Warning with stack trace');\n\n// Disable trace warnings\nprocess.traceProcessWarnings = false;\n```","summary":"The `process.traceProcessWarnings` property indicates whether the `--trace-warnings` flag is set on the current Node.js process. This property allows programmatic control over the tracing of warnings, enabling or disabling stack traces for warnings at runtime.","examples":[{"language":"js","displayName":null,"code":"// Enable trace warnings\nprocess.traceProcessWarnings = true;\n\n// Emit a warning with a stack trace\nprocess.emitWarning('Warning with stack trace');\n\n// Disable trace warnings\nprocess.traceProcessWarnings = false;"}],"children":[]},{"kind":"method","id":"processumask","name":"umask","title":"`process.umask()`","scope":"global","overloadOf":null,"stability":{"index":"0","description":"Deprecated. Calling `process.umask()` with no argument causes\nthe process-wide umask to be written twice. This introduces a race condition\nbetween threads, and is a potential security vulnerability. There is no safe,\ncross-platform alternative API."},"added":["v0.1.19"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v14.0.0","v12.19.0"],"prUrl":"https://github.com/nodejs/node/pull/32499","commit":null,"description":"Calling `process.umask()` with no arguments is deprecated."}],"signature":{"parameters":[],"returns":null},"description":"`process.umask()` returns the Node.js process's file mode creation mask. Child\nprocesses inherit the mask from the parent process.","summary":"`process.umask()` returns the Node.js process's file mode creation mask. Child processes inherit the mask from the parent process.","examples":[],"children":[]},{"kind":"method","id":"processumaskmask","name":"umask","title":"`process.umask(mask)`","scope":"global","overloadOf":"processumask","stability":null,"added":["v0.1.19"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"mask","type":{"text":"string | integer","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":9,"end":16}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"`process.umask(mask)` sets the Node.js process's file mode creation mask. Child\nprocesses inherit the mask from the parent process. Returns the previous mask.\n\n```mjs\nimport { umask } from 'node:process';\n\nconst newmask = 0o022;\nconst oldmask = umask(newmask);\nconsole.log(\n  `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`,\n);\n```\n\n```cjs\nconst { umask } = require('node:process');\n\nconst newmask = 0o022;\nconst oldmask = umask(newmask);\nconsole.log(\n  `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`,\n);\n```\n\nIn [`Worker`](worker_threads.html#class-worker) threads, `process.umask(mask)` will throw an exception.","summary":"`process.umask(mask)` sets the Node.js process's file mode creation mask. Child processes inherit the mask from the parent process. Returns the previous mask.","examples":[{"language":"mjs","displayName":null,"code":"import { umask } from 'node:process';\n\nconst newmask = 0o022;\nconst oldmask = umask(newmask);\nconsole.log(\n  `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`,\n);"},{"language":"cjs","displayName":null,"code":"const { umask } = require('node:process');\n\nconst newmask = 0o022;\nconst oldmask = umask(newmask);\nconsole.log(\n  `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`,\n);"}],"children":[]},{"kind":"method","id":"processunrefmayberefable","name":"unref","title":"`process.unref(maybeRefable)`","scope":"global","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.6.0","v22.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"maybeRefable","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"An object that may be \"unref'd\".","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"An object is \"unrefable\" if it implements the Node.js \"Refable protocol\".\nSpecifically, this means that the object implements the `Symbol.for('nodejs.ref')`\nand `Symbol.for('nodejs.unref')` methods. \"Ref'd\" objects will keep the Node.js\nevent loop alive, while \"unref'd\" objects will not. Historically, this was\nimplemented by using `ref()` and `unref()` methods directly on the objects.\nThis pattern, however, is being deprecated in favor of the \"Refable protocol\"\nin order to better support Web Platform API types whose APIs cannot be modified\nto add `ref()` and `unref()` methods but still need to support that behavior.","summary":"An object is \"unrefable\" if it implements the Node.js \"Refable protocol\". Specifically, this means that the object implements the `Symbol.for('nodejs.ref')` and `Symbol.for('nodejs.unref')` methods. \"Ref'd\" objects will keep the Node.js event loop alive, while \"unref'd\" objects will not. Historically, this was implemented by using `ref()` and `unref()` methods directly on the objects. This pattern, however, is being deprecated in favor of the \"Refable protocol\" in order to better support Web Platform API types whose APIs cannot be modified to add `ref()` and `unref()` methods but still need to support that behavior.","examples":[],"children":[]},{"kind":"method","id":"processuptime","name":"uptime","title":"`process.uptime()`","scope":"global","overloadOf":null,"stability":null,"added":["v0.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":""}},"description":"The `process.uptime()` method returns the number of seconds the current Node.js\nprocess has been running.\n\nThe return value includes fractions of a second. Use `Math.floor()` to get whole\nseconds.","summary":"The `process.uptime()` method returns the number of seconds the current Node.js process has been running.","examples":[],"children":[]},{"kind":"property","id":"processversion","name":"version","title":"`process.version`","scope":"global","overloadOf":null,"stability":null,"added":["v0.1.3"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The `process.version` property contains the Node.js version string.\n\n```mjs\nimport { version } from 'node:process';\n\nconsole.log(`Version: ${version}`);\n// Version: v14.8.0\n```\n\n```cjs\nconst { version } = require('node:process');\n\nconsole.log(`Version: ${version}`);\n// Version: v14.8.0\n```\n\nTo get the version string without the prepended *v*, use\n`process.versions.node`.","summary":"The `process.version` property contains the Node.js version string.","examples":[{"language":"mjs","displayName":null,"code":"import { version } from 'node:process';\n\nconsole.log(`Version: ${version}`);\n// Version: v14.8.0"},{"language":"cjs","displayName":null,"code":"const { version } = require('node:process');\n\nconsole.log(`Version: ${version}`);\n// Version: v14.8.0"}],"children":[]},{"kind":"property","id":"processversions","name":"versions","title":"`process.versions`","scope":"global","overloadOf":null,"stability":null,"added":["v0.2.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.0.0"],"prUrl":"https://github.com/nodejs/node/pull/15785","commit":null,"description":"The `v8` property now includes a Node.js specific suffix."},{"versions":["v4.2.0"],"prUrl":"https://github.com/nodejs/node/pull/3102","commit":null,"description":"The `icu` property is now supported."}],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"The `process.versions` property returns an object listing the version strings of\nNode.js and its dependencies. `process.versions.modules` indicates the current\nABI version, which is increased whenever a C++ API changes. Node.js will refuse\nto load modules that were compiled against a different module ABI version.\n\n```mjs\nimport { versions } from 'node:process';\n\nconsole.log(versions);\n```\n\n```cjs\nconst { versions } = require('node:process');\n\nconsole.log(versions);\n```\n\nWill generate an object similar to:\n\n```console\n{ node: '26.0.0-pre',\n  acorn: '8.15.0',\n  ada: '3.4.1',\n  amaro: '1.1.5',\n  ares: '1.34.6',\n  brotli: '1.2.0',\n  merve: '1.0.0',\n  cldr: '48.0',\n  icu: '78.2',\n  llhttp: '9.3.0',\n  modules: '144',\n  napi: '10',\n  nbytes: '0.1.1',\n  ncrypto: '0.0.1',\n  nghttp2: '1.68.0',\n  nghttp3: '',\n  ngtcp2: '',\n  openssl: '3.5.4',\n  simdjson: '4.2.4',\n  simdutf: '7.3.3',\n  sqlite: '3.51.2',\n  tz: '2025c',\n  undici: '7.18.2',\n  unicode: '17.0',\n  uv: '1.51.0',\n  uvwasi: '0.0.23',\n  v8: '14.3.127.18-node.10',\n  zlib: '1.3.1-e00f703',\n  zstd: '1.5.7' }\n```","summary":"The `process.versions` property returns an object listing the version strings of Node.js and its dependencies. `process.versions.modules` indicates the current ABI version, which is increased whenever a C++ API changes. Node.js will refuse to load modules that were compiled against a different module ABI version.","examples":[{"language":"mjs","displayName":null,"code":"import { versions } from 'node:process';\n\nconsole.log(versions);"},{"language":"cjs","displayName":null,"code":"const { versions } = require('node:process');\n\nconsole.log(versions);"},{"language":"console","displayName":null,"code":"{ node: '26.0.0-pre',\n  acorn: '8.15.0',\n  ada: '3.4.1',\n  amaro: '1.1.5',\n  ares: '1.34.6',\n  brotli: '1.2.0',\n  merve: '1.0.0',\n  cldr: '48.0',\n  icu: '78.2',\n  llhttp: '9.3.0',\n  modules: '144',\n  napi: '10',\n  nbytes: '0.1.1',\n  ncrypto: '0.0.1',\n  nghttp2: '1.68.0',\n  nghttp3: '',\n  ngtcp2: '',\n  openssl: '3.5.4',\n  simdjson: '4.2.4',\n  simdutf: '7.3.3',\n  sqlite: '3.51.2',\n  tz: '2025c',\n  undici: '7.18.2',\n  unicode: '17.0',\n  uv: '1.51.0',\n  uvwasi: '0.0.23',\n  v8: '14.3.127.18-node.10',\n  zlib: '1.3.1-e00f703',\n  zstd: '1.5.7' }"}],"children":[]},{"kind":"section","id":"exit-codes","name":"Exit codes","title":"Exit codes","scope":"global","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Node.js will normally exit with a `0` status code when no more async\noperations are pending. The following status codes are used in other\ncases:\n\n* `1` **Uncaught Fatal Exception**: There was an uncaught exception,\n  and it was not handled by a domain or an [`'uncaughtException'`](#event-uncaughtexception) event\n  handler.\n* `2`: Unused (reserved by Bash for builtin misuse)\n* `3` **Internal JavaScript Parse Error**: The JavaScript source code\n  internal in the Node.js bootstrapping process caused a parse error. This\n  is extremely rare, and generally can only happen during development\n  of Node.js itself.\n* `4` **Internal JavaScript Evaluation Failure**: The JavaScript\n  source code internal in the Node.js bootstrapping process failed to\n  return a function value when evaluated. This is extremely rare, and\n  generally can only happen during development of Node.js itself.\n* `5` **Fatal Error**: There was a fatal unrecoverable error in V8.\n  Typically a message will be printed to stderr with the prefix `FATAL\n  ERROR`.\n* `6` **Non-function Internal Exception Handler**: There was an\n  uncaught exception, but the internal fatal exception handler\n  function was somehow set to a non-function, and could not be called.\n* `7` **Internal Exception Handler Run-Time Failure**: There was an\n  uncaught exception, and the internal fatal exception handler\n  function itself threw an error while attempting to handle it. This\n  can happen, for example, if an [`'uncaughtException'`](#event-uncaughtexception) or\n  `domain.on('error')` handler throws an error.\n* `8`: Unused. In previous versions of Node.js, exit code 8 sometimes\n  indicated an uncaught exception.\n* `9` **Invalid Argument**: Either an unknown option was specified,\n  or an option requiring a value was provided without a value.\n* `10` **Internal JavaScript Run-Time Failure**: The JavaScript\n  source code internal in the Node.js bootstrapping process threw an error\n  when the bootstrapping function was called. This is extremely rare,\n  and generally can only happen during development of Node.js itself.\n* `12` **Invalid Debug Argument**: The `--inspect` and/or `--inspect-brk`\n  options were set, but the port number chosen was invalid or unavailable.\n* `13` **Unsettled Top-Level Await**: `await` was used outside of a function\n  in the top-level code, but the passed `Promise` never settled.\n* `14` **Snapshot Failure**: Node.js was started to build a V8 startup\n  snapshot and it failed because certain requirements of the state of\n  the application were not met.\n* `>128` **Signal Exits**: If Node.js receives a fatal signal such as\n  `SIGKILL` or `SIGHUP`, then its exit code will be `128` plus the\n  value of the signal code. This is a standard POSIX practice, since\n  exit codes are defined to be 7-bit integers, and signal exits set\n  the high-order bit, and then contain the value of the signal code.\n  For example, signal `SIGABRT` has value `6`, so the expected exit\n  code will be `128` + `6`, or `134`.","summary":"Node.js will normally exit with a `0` status code when no more async operations are pending. The following status codes are used in other cases:","examples":[],"children":[]}]}