Lỗi no process is associated with this object
The Show
7 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
7 event can make asynchronous calls, and thereby cause the Node.js process to continue. The listener callback function is invoked with the value of passed as the only argument. The
7 event is not emitted for conditions causing explicit termination, such as calling or uncaught exceptions. The
7 should not be used as an alternative to the
04 event unless the intention is to schedule additional work.
Event:
05 Added in: v0.7.7 If the Node.js process is spawned with an IPC channel (see the Child Process and Cluster documentation), the
05 event will be emitted when the IPC channel is closed. Event:
04 Added in: v0.1.7
The
04 event is emitted when the Node.js process is about to exit as a result of either:
There is no way to prevent the exiting of the event loop at this point, and once all
04 listeners have finished running the Node.js process will terminate. The listener callback function is invoked with the exit code specified either by the property, or the
13 argument passed to the method.
Listener functions must only perform synchronous operations. The Node.js process will exit immediately after calling the
04 event listeners causing any additional work still queued in the event loop to be abandoned. In the following example, for instance, the timeout will never occur:
Event:
16 Added in: v0.5.10
If the Node.js process is spawned with an IPC channel (see the Child Process and Cluster documentation), the
16 event is emitted whenever a message sent by a parent process using is received by the child process. The message goes through serialization and parsing. The resulting message might not be the same as what is originally sent. If the
23 option was set to
24 used when spawning the process, the
17 argument can contain data that JSON is not able to represent. See for more details. Event:
27 Added in: v10.12.0Deprecated since: v17.6.0, v16.15.0
The
27 event is emitted whenever a
34 has been either:
This is useful for tracking potential errors in an application while using the
34 constructor, as multiple resolutions are silently swallowed. However, the occurrence of this event does not necessarily indicate an error. For example,
36 can trigger a
27 event. Because of the unreliability of the event in cases like the
36 example above it has been deprecated.
Event:
39 Added in: v1.4.1
The
39 event is emitted whenever a
34 has been rejected and an error handler was attached to it (using
43, for example) later than one turn of the Node.js event loop. The
34 object would have previously been emitted in an
45 event, but during the course of processing gained a rejection handler. There is no notion of a top level for a
34 chain at which rejections can always be handled. Being inherently asynchronous in nature, a
34 rejection can be handled at a future point in time, possibly much later than the event loop turn it takes for the
45 event to be emitted. Another way of stating this is that, unlike in synchronous code where there is an ever-growing list of unhandled exceptions, with Promises there can be a growing-and-shrinking list of unhandled rejections. In synchronous code, the
49 event is emitted when the list of unhandled exceptions grows. In asynchronous code, the
45 event is emitted when the list of unhandled rejections grows, and the
39 event is emitted when the list of unhandled rejections shrinks.
In this example, the
52
53 will grow and shrink over time, reflecting rejections that start unhandled and then become handled. It is possible to record such errors in an error log, either periodically (which is likely best for long-running application) or upon process exit (which is likely most convenient for scripts). Event:
49
The
49 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
65 and exiting with code 1, overriding any previously set . Adding a handler for the
49 event overrides this default behavior. Alternatively, change the in the
49 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.
It is possible to monitor
49 events without overriding the default behavior to exit the process by installing a
71 listener. Warning: Using
49 correctly
49 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
74. 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. Exceptions thrown from within the event handler will not be caught. Instead the process will exit with a non-zero exit code and the stack trace will be printed. This is to avoid infinite recursion. Attempting to resume normally after an uncaught exception can be similar to pulling out the power cord when upgrading a computer. Nine out of ten times, nothing happens. But the tenth time, the system becomes corrupted. The correct use of
49 is to perform synchronous cleanup of allocated resources (e.g. file descriptors, handles, etc) before shutting down the process. It is not safe to resume normal operation after
49. To restart a crashed application in a more reliable way, whether
49 is emitted or not, an external monitor should be employed in a separate process to detect application failures and recover or restart as needed. Event:
71 Added in: v13.7.0, v12.17.0
The
71 event is emitted before an
49 event is emitted or a hook installed via is called. Installing an
71 listener does not change the behavior once an
49 event is emitted. The process will still crash if no
49 listener is installed.
Event:
45
The
45 event is emitted whenever a
34 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
43 and are propagated through a
34 chain. The
45 event is useful for detecting and keeping track of promises that were rejected whose rejections have not yet been handled.
The following will also trigger the
45 event to be emitted:
In this example case, it is possible to track the rejection as a developer error as would typically be the case for other
45 events. To address such failures, a non-operational
05 handler may be attached to
06, which would prevent the
45 event from being emitted. Event:
08 Added in: v6.0.0
The
08 event is emitted whenever Node.js emits a process warning. A process warning is similar to an error in that it describes exceptional conditions that are being brought to the user's attention. However, warnings are not part of the normal Node.js and JavaScript error handling flow. Node.js can emit warnings whenever it detects bad coding practices that could lead to sub-optimal application performance, bugs, or security vulnerabilities.
0 By default, Node.js will print process warnings to
65. The
16 command-line option can be used to suppress the default console output but the
08 event will still be emitted by the
4 object. Currently, it is not possible to suppress specific warning types other than deprecation warnings. To suppress deprecation warnings, check out the flag. The following example illustrates the warning that is printed to
65 when too many listeners have been added to an event:
1 In contrast, the following example turns off the default warning output and adds a custom handler to the
08 event:
2 The
22 command-line option can be used to have the default console output for warnings include the full stack trace of the warning. Launching Node.js using the
23 command-line flag will cause custom deprecation warnings to be thrown as exceptions. Using the
24 command-line flag will cause the custom deprecation to be printed to
65 along with the stack trace. Using the
19 command-line flag will suppress all reporting of the custom deprecation. The
27 command-line flags only affect warnings that use the name
28. Event:
29 Added in: v16.2.0, v14.18.0
The
29 event is emitted after a new thread has been created. Emitting custom warningsSee the method for issuing custom or application-specific warnings. Node.js warning namesThere are no strict guidelines for warning types (as identified by the
10 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:
Signal eventsSignal events will be emitted when the Node.js process receives a signal. Please refer to
44 for a listing of standard POSIX signal names such as
45,
46, etc. Signals are not available on threads. The signal handler will receive the signal's name (
45,
49, etc.) as the first argument. The name of each event will be the uppercase common name for the signal (e.g.
45 for
51 signals).
3
Windows does not support signals so has no equivalent to termination by signal, but Node.js offers some emulation with , and :
78 Added in: v0.7.0 The
78 method causes the Node.js process to exit immediately and generate a core file. This feature is not available in threads.
81 Added in: v10.10.0 The
81 property is a special, read-only
83 of flags allowable within the environment variable.
81 extends
83, but overrides
87 to recognize several different possible flag representations.
88 will return
89 in the following cases:
When iterating over
81, flags will appear only once; each will begin with one or more dashes. Flags passed through to V8 will contain underscores instead of non-leading dashes:
4 The methods
04,
05, and
06 of
81 do nothing, and will fail silently. If Node.js was compiled without support (shown in ),
81 will contain what would have been allowable.
11 Added in: v0.5.0 The operating system CPU architecture for which the Node.js binary was compiled. Possible values are:
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22, and
23.
5
24 Added in: v0.1.27 The
24 property returns an array containing the command-line arguments passed when the Node.js process was launched. The first element will be . See
27 if access to the original value of
28 is needed. The second element will be the path to the JavaScript file being executed. The remaining elements will be any additional command-line arguments. For example, assuming the following script for
29:
6 Launching the Node.js process as:
7 Would generate the output:
8
27 Added in: v6.4.0 The
27 property stores a read-only copy of the original value of
28 passed when Node.js starts.
9
33 If the Node.js process was spawned with an IPC channel (see the Child Process documentation), the
33 property is a reference to the IPC channel. If no IPC channel exists, this property is
35.
36 Added in: v7.1.0 This method makes the IPC channel keep the event loop of the process running if
37 has been called before. Typically, this is managed through the number of
05 and
16 listeners on the
4 object. However, this method can be used to explicitly request a specific behavior.
41 Added in: v7.1.0 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. Typically, this is managed through the number of
05 and
16 listeners on the
4 object. However, this method can be used to explicitly request a specific behavior.
45 Added in: v0.1.17
The
47 method changes the current working directory of the Node.js process or throws an exception if doing so fails (for instance, if the specified
46 does not exist).
0 This feature is not available in threads.
09 The
09 property returns a frozen
52 containing the JavaScript representation of the configure options used to compile the current Node.js executable. This is the same as the
53 file that was produced when running the
54 script. An example of the possible output looks like:
1
55 Added in: v0.7.2 If the Node.js process is spawned with an IPC channel (see the Child Process and Cluster documentation), the
55 property will return
89 so long as the IPC channel is connected and will return
58 after
59 is called. Once
55 is
58, it is no longer possible to send messages over the IPC channel using
62.
63 Added in: v19.6.0, v18.15.0
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,
35 is returned. See for more information.
66 Added in: v6.1.0
The
68 method returns the user and system CPU time usage of the current process, in an object with properties
69 and
70, 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. The result of a previous call to
68 can be passed as the argument to the function, to get a diff reading.
2
75 Added in: v0.1.8
The
75 method returns the current working directory of the Node.js process.
3
77 Added in: v0.7.2 The port used by the Node.js debugger when enabled.
4
59 Added in: v0.7.2 If the Node.js process is spawned with an IPC channel (see the Child Process and Cluster documentation), the
59 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. The effect of calling
59 is the same as calling from the parent process. If the Node.js process was not spawned with an IPC channel,
59 will be
35.
84
The
89 method allows dynamically loading shared objects. It is primarily used by
90 to load C++ Addons, and should not be used directly, except in special cases. In other words, should be preferred over
89 unless there are specific reasons such as custom dlopen flags or loading from ES modules. The
87 argument is an integer that allows to specify dlopen behavior. See the documentation for details. An important requirement when calling
89 is that the
85 instance must be passed. Functions exported by the C++ Addon are then accessible via
97. The example below shows how to load a C++ Addon, named
98, that exports a
99 function. All the symbols are loaded before the call returns, by passing the
00 constant. In this example the constant is assumed to be available.
5
01 Added in: v8.0.0
The
32 method can be used to emit custom or application specific process warnings. These can be listened for by adding a handler to the event.
6 In this example, an
96 object is generated internally by
32 and passed through to the handler.
7 If
09 is passed as an
96 object, the
03 argument is ignored.
24 Added in: v6.0.0
The
32 method can be used to emit custom or application specific process warnings. These can be listened for by adding a handler to the event.
8
9
0 In each of the previous examples, an
96 object is generated internally by
32 and passed through to the handler.
1 If
09 is passed as an
96 object, it will be passed through to the
08 event handler unmodified (and the optional
28,
08 and
10 arguments will be ignored):
2 A
48 is thrown if
09 is anything other than a string or
96 object. While process warnings use
96 objects, the process warning mechanism is not a replacement for normal error handling mechanisms. The following additional handling is implemented if the warning
28 is
28:
Avoiding duplicate warningsAs a best practice, warnings should be emitted only once per process. To do so, place the
58 behind a boolean.
3
59 The
59 property returns an object containing the user environment. See
61. An example of this object looks like:
4 It is possible to modify this object, but such modifications will not be reflected outside the Node.js process, or (unless explicitly requested) to other threads. In other words, the following example would not work:
5 While the following will:
6 Assigning a property on
59 will implicitly convert the value to a string. This behavior is deprecated. Future versions of Node.js may throw an error when the value is not a string, number, or boolean.
7 Use
64 to delete a property from
59.
8 On Windows operating systems, environment variables are case-insensitive.
9 Unless explicitly specified when creating a instance, each thread has its own copy of
59, based on its parent thread's
59, or whatever was specified as the
70 option to the constructor. Changes to
59 will not be visible across threads, and only the main thread can make changes that are visible to the operating system or to native add-ons. On Windows, a copy of
59 on a instance operates in a case-sensitive manner unlike the main thread.
76 Added in: v0.7.7 The
76 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 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.
0 Results in
76:
1 And
24:
2 Refer to for the detailed behavior of worker threads with this property.
26 Added in: v0.1.100 The
26 property returns the absolute pathname of the executable that started the Node.js process. Symbolic links, if any, are resolved.
3
84
The
02 method instructs Node.js to terminate the process synchronously with an exit status of
08. If
08 is omitted, exit uses either the 'success' code
71 or the value of
00 if it has been set. Node.js will not terminate until all the event listeners are called. To exit with a 'failure' code:
4 The shell that executed Node.js should see the exit code as
93. Calling
02 will force the process to exit as quickly as possible even if there are still asynchronous operations pending that have not yet completed fully, including I/O operations to
95 and
96. In most situations, it is not actually necessary to call
02 explicitly. The Node.js process will exit on its own if there is no additional work pending in the event loop. The
00 property can be set to tell the process which exit code to use when the process exits gracefully. For instance, the following example illustrates a misuse of the
02 method that could lead to data printed to stdout being truncated and lost:
5 The reason this is problematic is because writes to
95 in Node.js are sometimes asynchronous and may occur over multiple ticks of the Node.js event loop. Calling
02, however, forces the process to exit before those additional writes to
02 can be performed. Rather than calling
02 directly, the code should set the
00 and allow the process to exit naturally by avoiding scheduling any additional work for the event loop:
6 If it is necessary to terminate the Node.js process due to an error condition, throwing an uncaught error and allowing the process to terminate accordingly is safer than calling
02. In threads, this function stops the current thread rather than the current process.
00
A number which will be the process exit code, when the process either exits gracefully, or is exited via without specifying a code. Specifying a code to will override any previous setting of
00.
12 Added in: v17.3.0, v16.14.0
The
12 method returns an array of strings containing the types of the active resources that are currently keeping the event loop alive.
7
14 Added in: v2.0.0 The
14 method returns the numerical effective group identity of the Node.js process. (See
16.)
8 This function is only available on POSIX platforms (i.e. not Windows or Android).
17 Added in: v2.0.0
The
17 method returns the numerical effective user identity of the process. (See
19.)
9 This function is only available on POSIX platforms (i.e. not Windows or Android).
20 Added in: v0.1.31
The
20 method returns the numerical group identity of the process. (See
22.)
0 This function is only available on POSIX platforms (i.e. not Windows or Android).
23 Added in: v0.9.4
The
23 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.
1 This function is only available on POSIX platforms (i.e. not Windows or Android).
25 Added in: v0.1.28
The
25 method returns the numeric user identity of the process. (See
27.)
2 This function is only available on POSIX platforms (i.e. not Windows or Android).
28 Added in: v9.3.0
Indicates whether a callback has been set using .
30 Added in: v0.7.6
This is the legacy version of before
34 was introduced in JavaScript. The
32 method returns the current high-resolution real time in a
36 tuple
37, where
38 is the remaining part of the real time that can't be represented in second precision.
31 is an optional parameter that must be the result of a previous
32 call to diff with the current time. If the parameter passed in is not a tuple
37, a
48 will be thrown. Passing in a user-defined array instead of the result of a previous call to
32 will lead to undefined behavior. These times are relative to an arbitrary time in the past, and not related to the time of day and therefore not subject to clock drift. The primary use is for measuring performance between intervals:
3
33 Added in: v10.7.0
The
34 version of the method returning the current high-resolution real time in nanoseconds as a
34. Unlike , it does not support an additional
31 argument since the difference can just be computed directly by subtraction of the two
34s.
4
51 Added in: v0.9.4
The
54 method reads the
55 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
56 access or the
57 capability. Use care when dropping privileges:
5 This function is only available on POSIX platforms (i.e. not Windows or Android). This feature is not available in threads.
59 Added in: v0.0.6
The
72 method sends the
61 to the process identified by
60. Signal names are strings such as
45 or
46. See and
70 for more information. This method will throw an error if the target
60 does not exist. As a special case, a signal of
71 can be used to test for the existence of a process. Windows platforms will throw an error if the
60 is used to kill a process group. Even though the name of this function is
72, it is really just a signal sender, like the
73 system call. The signal sent may do something other than kill the target process.
6 When
74 is received by a Node.js process, Node.js will start the debugger. See .
75 Added in: v0.1.17Deprecated since: v14.0.0 The
75 property provides an alternative way of retrieving . The difference is that if the main module changes at runtime, 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. As with ,
75 will be
35 if there is no entry script.
82
Returns an object describing the memory usage of the Node.js process measured in bytes.
7
When using threads,
83 will be a value that is valid for the entire process, while the other fields will only refer to the current thread. The
82 method iterates over each page to gather information about memory usage which might be slow depending on the program memory allocations.
02 Added in: v15.6.0, v14.18.0
The
02 method returns an integer representing the Resident Set Size (RSS) in bytes. The Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the process, including all C++ and JavaScript objects and code. This is the same value as the
83 property provided by
82 but
02 is faster.
8
07
11 adds
08 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
11. See the guide for more background.
9 This is important when developing APIs in order to give users the opportunity to assign event handlers after an object has been constructed but before any I/O has occurred:
0 It is very important for APIs to be either 100% synchronous or 100% asynchronous. Consider this example:
1 This API is hazardous because in the following case:
2 It is not clear whether
14 or
15 will be called first. The following approach is much better:
3 When to use
16 vs.
11 The API is an alternative to
11 that also defers execution of a function using the same microtask queue used to execute the then, catch, and finally handlers of resolved promises. Within Node.js, every time the "next tick queue" is drained, the microtask queue is drained immediately after.
4 For most userland use cases, the
16 API provides a portable and reliable mechanism for deferring execution that works across multiple JavaScript platform environments and should be favored over
11. In simple scenarios,
16 can be a drop-in replacement for
11.
5 One note-worthy difference between the two APIs is that
11 allows specifying additional values that will be passed as arguments to the deferred function when it is called. Achieving the same result with
16 requires using either a closure or a bound function:
6 There are minor differences in the way errors raised from within the next tick queue and microtask queue are handled. Errors thrown within a queued microtask callback should be handled within the queued callback when possible. If they are not, the
26 event handler can be used to capture and handle the errors. When in doubt, unless the specific capabilities of
11 are needed, use
16.
29 Added in: v0.8.0 The
29 property indicates whether the
19 flag is set on the current Node.js process. See the documentation for the and the for more information about this flag's behavior.
34 Added in: v20.0.0 This API is available through the flag.
34 is an object whose methods are used to manage permissions for the current process. Additional documentation is available in the .
37 Added in: v20.0.0
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,
40 will check if the process has ALL file system read permissions. The reference has a meaning based on the provided scope. For example, the reference when the scope is File System means files and folders. The available scopes are:
7
46 Added in: v0.1.15 The
46 property returns the PID of the process.
8
48 Added in: v0.1.16 The
48 property returns a string identifying the operating system platform for which the Node.js binary was compiled. Currently possible values are:
9 The value
57 may also be returned if the Node.js is built on the Android operating system. However, Android support in Node.js .
58 Added in: v9.2.0, v8.10.0, v6.13.0 The
58 property returns the PID of the parent of the current process.
0
60 The
60 property returns an
52 containing metadata related to the current release, including URLs for the source tarball and headers-only tarball.
60 contains the following properties:
1 In custom builds from non-release versions of the source tree, only the
10 property may be present. The additional properties should not be relied upon to exist.
78
78 is an object whose methods are used to generate diagnostic reports for the current process. Additional documentation is available in the report documentation.
80 Added in: v13.12.0, v12.17.0 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.
2
81 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.
3
82 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. If the value of
82 is set to
84 or
85, the report is written to the stdout or stderr of the process respectively.
4
86
Returns a JavaScript Object representation of a diagnostic report for the running process. The report's JavaScript stack trace is taken from
55, if present.
5 Additional documentation is available in the report documentation.
89 If
89, a diagnostic report is generated on fatal errors, such as out of memory errors or failed C++ assertions.
6
91 If
89, a diagnostic report is generated when the process receives the signal specified by
93.
7
94 If
89, a diagnostic report is generated on uncaught exception.
8
93 The signal used to trigger the creation of a diagnostic report. Defaults to
97.
9
98
Writes a diagnostic report to a file. If
86 is not provided, the default filename includes the date, time, PID, and a sequence number. The report's JavaScript stack trace is taken from
55, if present. If the value of
86 is set to
84 or
85, the report is written to the stdout or stderr of the process respectively.
0 Additional documentation is available in the report documentation.
07 Added in: v12.6.0
1
44 Added in: v0.5.9
If Node.js is spawned with an IPC channel, the
62 method can be used to send messages to the parent process. Messages will be received as a event on the parent's object. If Node.js was not spawned with an IPC channel,
57 will be
35. The message goes through serialization and parsing. The resulting message might not be the same as what is originally sent.
59 Added in: v2.0.0
The
61 method sets the effective group identity of the process. (See
62.) The
60 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.
2 This function is only available on POSIX platforms (i.e. not Windows or Android). This feature is not available in threads.
65 Added in: v2.0.0
The
67 method sets the effective user identity of the process. (See
68.) The
60 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.
3 This function is only available on POSIX platforms (i.e. not Windows or Android). This feature is not available in threads.
71 Added in: v0.1.31
The
73 method sets the group identity of the process. (See
74.) The
60 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.
4 This function is only available on POSIX platforms (i.e. not Windows or Android). This feature is not available in threads.
77 Added in: v0.9.4
The
79 method sets the supplementary group IDs for the Node.js process. This is a privileged operation that requires the Node.js process to have
56 or the
57 capability. The
78 array can contain numeric group IDs, group names, or both.
5 This function is only available on POSIX platforms (i.e. not Windows or Android). This feature is not available in threads.
84 Added in: v0.1.28
The
84 method sets the user identity of the process. (See
87.) The
60 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.
6 This function is only available on POSIX platforms (i.e. not Windows or Android). This feature is not available in threads.
90 Added in: v16.6.0, v14.18.0
This function enables or disables the Source Map v3 support for stack traces. It provides same features as launching Node.js process with commandline options
92. Only source maps in JavaScript files that are loaded after source maps has been enabled will be parsed and loaded.
93 Added in: v9.3.0
The
90 function sets a function that will be invoked when an uncaught exception occurs, which will receive the exception value itself as its first argument. If such a function is set, the event will not be emitted. If
97 was passed from the command line or set through , the process will not abort. Actions configured to take place on exceptions such as report generations will be affected too To unset the capture function,
99 may be used. Calling this method with a non-
00 argument while another capture function is set will throw an error. Using this function is mutually exclusive with using the deprecated
01 built-in module.
02 Added in: v20.7.0 The
02 property returns whether the Source Map v3 support for stack traces is enabled.
96 The
96 property returns a stream connected to
65 (fd
07). It is a (which is a stream) unless fd
07 refers to a file, in which case it is a stream.
96 differs from other Node.js streams in important ways. See for more information.
11 This property refers to the value of underlying file descriptor of
96. The value is fixed at
07. In threads, this field does not exist.
15 The
15 property returns a stream connected to
17 (fd
71). It is a (which is a stream) unless fd
71 refers to a file, in which case it is a stream. For details of how to read from
17 see . As a stream,
15 can also be used in "old" mode that is compatible with scripts written for Node.js prior to v0.10. For more information see . In "old" streams mode the
17 stream is paused by default, so one must call
25 to read from it. Note also that calling
25 itself would switch stream to "old" mode.
27 This property refers to the value of underlying file descriptor of
15. The value is fixed at
71. In threads, this field does not exist.
95 The
95 property returns a stream connected to
02 (fd
93). It is a (which is a stream) unless fd
93 refers to a file, in which case it is a stream. For example, to copy
15 to
95:
7
95 differs from other Node.js streams in important ways. See for more information.
40 This property refers to the value of underlying file descriptor of
95. The value is fixed at
93. In threads, this field does not exist. A note on process I/O
95 and
96 differ from other Node.js streams in important ways:
These behaviors are partly for historical reasons, as changing them would create backward incompatibility, but they are also expected by some users. Synchronous writes avoid problems such as output written with
46 or
47 being unexpectedly interleaved, or not written at all if
02 is called before an asynchronous write completes. See for more information. Warning: Synchronous writes block the event loop until the write has completed. This can be near instantaneous in the case of output to a file, but under high system load, pipes that are not being read at the receiving end, or with slow terminals or file systems, it's possible for the event loop to be blocked often enough and long enough to have severe negative performance impacts. This may not be a problem when writing to an interactive terminal session, but consider this particularly careful when doing production logging to the process output streams. To check if a stream is connected to a context, check the
52 property. For instance:
8 See the documentation for more information.
53 Added in: v0.9.12 The initial value of
53 indicates whether the
23 flag is set on the current Node.js process.
53 is mutable, so whether or not deprecation warnings result in errors may be altered at runtime. See the documentation for the and the for more information.
9
59 Added in: v0.1.104 The
59 property returns the current process title (i.e. returns the current value of
61). Assigning a new value to
59 modifies the current value of
61. When a new value is assigned, different platforms will impose different maximum length restrictions on the title. Usually such restrictions are quite limited. For instance, on Linux and macOS,
59 is limited to the size of the binary name plus the length of the command-line arguments because setting the
59 overwrites the
66 memory of the process. Node.js v0.8 allowed for longer process title strings by also overwriting the
67 memory but that was potentially insecure and confusing in some (rather obscure) cases. Assigning a value to
59 might not result in an accurate label within process manager applications such as macOS Activity Monitor or Windows Services Manager.
69 Added in: v0.8.0 The
69 property indicates whether the
24 flag is set on the current Node.js process. See the documentation for the and the for more information about this flag's behavior.
74 - Deprecated. Calling
74 with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential security vulnerability. There is no safe, cross-platform alternative API.
74 returns the Node.js process's file mode creation mask. Child processes inherit the mask from the parent process.
77 Added in: v0.1.19
77 sets the Node.js process's file mode creation mask. Child processes inherit the mask from the parent process. Returns the previous mask.
0 In threads,
77 will throw an exception.
82 Added in: v0.5.0
The
82 method returns the number of seconds the current Node.js process has been running. The return value includes fractions of a second. Use
84 to get whole seconds.
85 Added in: v0.1.3 The
85 property contains the Node.js version string.
1 To get the version string without the prepended v, use
87.
88 The
88 property returns an object listing the version strings of Node.js and its dependencies.
90 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.
2 Will generate an object similar to:
3 Exit codesNode.js will normally exit with a
71 status code when no more async operations are pending. The following status codes are used in other cases: |