@types/node 20.12.7 → 20.12.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/assert.d.ts +41 -44
- node/async_hooks.d.ts +17 -15
- node/buffer.d.ts +7 -7
- node/child_process.d.ts +1 -1
- node/cluster.d.ts +1 -1
- node/console.d.ts +1 -1
- node/crypto.d.ts +38 -3
- node/dgram.d.ts +13 -13
- node/diagnostics_channel.d.ts +3 -3
- node/dns.d.ts +1 -1
- node/domain.d.ts +4 -4
- node/events.d.ts +29 -37
- node/fs/promises.d.ts +12 -12
- node/fs.d.ts +37 -37
- node/http.d.ts +4 -4
- node/http2.d.ts +77 -47
- node/https.d.ts +1 -1
- node/inspector.d.ts +4 -4
- node/net.d.ts +50 -8
- node/os.d.ts +28 -11
- node/package.json +2 -2
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +3 -3
- node/process.d.ts +214 -43
- node/punycode.d.ts +4 -4
- node/querystring.d.ts +18 -6
- node/readline/promises.d.ts +9 -9
- node/readline.d.ts +21 -20
- node/repl.d.ts +7 -7
- node/stream/web.d.ts +2 -2
- node/stream.d.ts +8 -6
- node/string_decoder.d.ts +3 -3
- node/test.d.ts +25 -23
- node/timers/promises.d.ts +10 -6
- node/timers.d.ts +5 -5
- node/tls.d.ts +39 -32
- node/trace_events.d.ts +40 -25
- node/tty.d.ts +8 -8
- node/url.d.ts +5 -5
- node/util.d.ts +115 -22
- node/v8.d.ts +6 -6
- node/vm.d.ts +35 -17
- node/wasi.d.ts +1 -1
- node/worker_threads.d.ts +16 -16
- node/zlib.d.ts +16 -3
node/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Mon, 06 May 2024 14:07:34 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node/assert.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* The `node:assert` module provides a set of assertion functions for verifying
|
3
3
|
* invariants.
|
4
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
4
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/assert.js)
|
5
5
|
*/
|
6
6
|
declare module "assert" {
|
7
7
|
/**
|
@@ -12,7 +12,7 @@ declare module "assert" {
|
|
12
12
|
function assert(value: unknown, message?: string | Error): asserts value;
|
13
13
|
namespace assert {
|
14
14
|
/**
|
15
|
-
* Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class.
|
15
|
+
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
|
16
16
|
*/
|
17
17
|
class AssertionError extends Error {
|
18
18
|
/**
|
@@ -76,7 +76,7 @@ declare module "assert" {
|
|
76
76
|
* @since v14.2.0, v12.19.0
|
77
77
|
* @param [fn='A no-op function']
|
78
78
|
* @param [exact=1]
|
79
|
-
* @return that wraps `fn`.
|
79
|
+
* @return A function that wraps `fn`.
|
80
80
|
*/
|
81
81
|
calls(exact?: number): () => void;
|
82
82
|
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
|
@@ -96,8 +96,7 @@ declare module "assert" {
|
|
96
96
|
* [{ thisArg: undefined, arguments: [1, 2, 3] }]);
|
97
97
|
* ```
|
98
98
|
* @since v18.8.0, v16.18.0
|
99
|
-
* @
|
100
|
-
* @return An Array with all the calls to a tracked function.
|
99
|
+
* @return An array with all the calls to a tracked function.
|
101
100
|
*/
|
102
101
|
getCalls(fn: Function): CallTrackerCall[];
|
103
102
|
/**
|
@@ -130,12 +129,11 @@ declare module "assert" {
|
|
130
129
|
* // ]
|
131
130
|
* ```
|
132
131
|
* @since v14.2.0, v12.19.0
|
133
|
-
* @return An
|
132
|
+
* @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}.
|
134
133
|
*/
|
135
134
|
report(): CallTrackerReportInformation[];
|
136
135
|
/**
|
137
|
-
* Reset calls of the call tracker.
|
138
|
-
* If a tracked function is passed as an argument, the calls will be reset for it.
|
136
|
+
* Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it.
|
139
137
|
* If no arguments are passed, all tracked functions will be reset.
|
140
138
|
*
|
141
139
|
* ```js
|
@@ -158,7 +156,7 @@ declare module "assert" {
|
|
158
156
|
*/
|
159
157
|
reset(fn?: Function): void;
|
160
158
|
/**
|
161
|
-
* Iterates through the list of functions passed to
|
159
|
+
* Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that
|
162
160
|
* have not been called the expected number of times.
|
163
161
|
*
|
164
162
|
* ```js
|
@@ -232,10 +230,10 @@ declare module "assert" {
|
|
232
230
|
stackStartFn?: Function,
|
233
231
|
): never;
|
234
232
|
/**
|
235
|
-
* Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
|
233
|
+
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
|
236
234
|
*
|
237
|
-
* If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default
|
238
|
-
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
235
|
+
* If `value` is not truthy, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is `undefined`, a default
|
236
|
+
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
239
237
|
* If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
|
240
238
|
*
|
241
239
|
* Be aware that in the `repl` the error message will be different to the one
|
@@ -317,8 +315,8 @@ declare module "assert" {
|
|
317
315
|
* // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
|
318
316
|
* ```
|
319
317
|
*
|
320
|
-
* If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default
|
321
|
-
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
318
|
+
* If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
|
319
|
+
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
322
320
|
* @since v0.1.21
|
323
321
|
*/
|
324
322
|
function equal(actual: unknown, expected: unknown, message?: string | Error): void;
|
@@ -347,8 +345,8 @@ declare module "assert" {
|
|
347
345
|
* // AssertionError: 1 != '1'
|
348
346
|
* ```
|
349
347
|
*
|
350
|
-
* If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error
|
351
|
-
* message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
348
|
+
* If the values are equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error
|
349
|
+
* message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
352
350
|
* @since v0.1.21
|
353
351
|
*/
|
354
352
|
function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
@@ -414,8 +412,8 @@ declare module "assert" {
|
|
414
412
|
* // OK
|
415
413
|
* ```
|
416
414
|
*
|
417
|
-
* If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default
|
418
|
-
* error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
415
|
+
* If the values are deeply equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
|
416
|
+
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
419
417
|
* instead of the `AssertionError`.
|
420
418
|
* @since v0.1.21
|
421
419
|
*/
|
@@ -452,8 +450,8 @@ declare module "assert" {
|
|
452
450
|
* // TypeError: Inputs are not identical
|
453
451
|
* ```
|
454
452
|
*
|
455
|
-
* If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
|
456
|
-
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
453
|
+
* If the values are not strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
|
454
|
+
* default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
457
455
|
* instead of the `AssertionError`.
|
458
456
|
* @since v0.1.21
|
459
457
|
*/
|
@@ -477,8 +475,8 @@ declare module "assert" {
|
|
477
475
|
* // OK
|
478
476
|
* ```
|
479
477
|
*
|
480
|
-
* If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
|
481
|
-
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
478
|
+
* If the values are strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
|
479
|
+
* default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
482
480
|
* instead of the `AssertionError`.
|
483
481
|
* @since v0.1.21
|
484
482
|
*/
|
@@ -519,7 +517,7 @@ declare module "assert" {
|
|
519
517
|
* using an object, it is also possible to use a regular expression, when
|
520
518
|
* validating against a string property. See below for examples.
|
521
519
|
*
|
522
|
-
* If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation
|
520
|
+
* If specified, `message` will be appended to the message provided by the `AssertionError` if the `fn` call fails to throw or in case the error validation
|
523
521
|
* fails.
|
524
522
|
*
|
525
523
|
* Custom validation object/error instance:
|
@@ -649,8 +647,8 @@ declare module "assert" {
|
|
649
647
|
* ```
|
650
648
|
*
|
651
649
|
* `error` cannot be a string. If a string is provided as the second
|
652
|
-
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same
|
653
|
-
* message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
|
650
|
+
* argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Using the same
|
651
|
+
* message as the thrown error message is going to result in an `ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
|
654
652
|
* a string as the second argument gets considered:
|
655
653
|
*
|
656
654
|
* ```js
|
@@ -703,9 +701,9 @@ declare module "assert" {
|
|
703
701
|
* adding a comment next to the specific code path that should not throw and keep
|
704
702
|
* error messages as expressive as possible.
|
705
703
|
*
|
706
|
-
* When `assert.doesNotThrow()` is called, it will immediately call the `fn`function.
|
704
|
+
* When `assert.doesNotThrow()` is called, it will immediately call the `fn` function.
|
707
705
|
*
|
708
|
-
* If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a
|
706
|
+
* If an error is thrown and it is the same type as that specified by the `error` parameter, then an `AssertionError` is thrown. If the error is of a
|
709
707
|
* different type, or if the `error` parameter is undefined, the error is
|
710
708
|
* propagated back to the caller.
|
711
709
|
*
|
@@ -741,7 +739,7 @@ declare module "assert" {
|
|
741
739
|
* );
|
742
740
|
* ```
|
743
741
|
*
|
744
|
-
* If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
|
742
|
+
* If an `AssertionError` is thrown and a value is provided for the `message` parameter, the value of `message` will be appended to the `AssertionError` message:
|
745
743
|
*
|
746
744
|
* ```js
|
747
745
|
* import assert from 'node:assert/strict';
|
@@ -762,7 +760,7 @@ declare module "assert" {
|
|
762
760
|
/**
|
763
761
|
* Throws `value` if `value` is not `undefined` or `null`. This is useful when
|
764
762
|
* testing the `error` argument in callbacks. The stack trace contains all frames
|
765
|
-
* from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
|
763
|
+
* from the error passed to `ifError()` including the potential new frames for `ifError()` itself.
|
766
764
|
*
|
767
765
|
* ```js
|
768
766
|
* import assert from 'node:assert/strict';
|
@@ -797,18 +795,18 @@ declare module "assert" {
|
|
797
795
|
* calls the function and awaits the returned promise to complete. It will then
|
798
796
|
* check that the promise is rejected.
|
799
797
|
*
|
800
|
-
* If `asyncFn` is a function and it throws an error synchronously
|
801
|
-
* function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an
|
802
|
-
* handler is skipped.
|
798
|
+
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
|
799
|
+
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value)
|
800
|
+
* error. In both cases the error handler is skipped.
|
803
801
|
*
|
804
802
|
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
805
803
|
*
|
806
804
|
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
807
805
|
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
808
806
|
* an object where each property will be tested for, or an instance of error where
|
809
|
-
* each property will be tested for including the non-enumerable `message` and`name` properties.
|
807
|
+
* each property will be tested for including the non-enumerable `message` and `name` properties.
|
810
808
|
*
|
811
|
-
* If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
|
809
|
+
* If specified, `message` will be the message provided by the `{@link AssertionError}` if the `asyncFn` fails to reject.
|
812
810
|
*
|
813
811
|
* ```js
|
814
812
|
* import assert from 'node:assert/strict';
|
@@ -850,10 +848,9 @@ declare module "assert" {
|
|
850
848
|
* });
|
851
849
|
* ```
|
852
850
|
*
|
853
|
-
* `error` cannot be a string. If a string is provided as the second
|
854
|
-
*
|
855
|
-
* example in {@link throws} carefully if using a string as the second
|
856
|
-
* argument gets considered.
|
851
|
+
* `error` cannot be a string. If a string is provided as the second argument, then `error` is assumed to
|
852
|
+
* be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Please read the
|
853
|
+
* example in {@link throws} carefully if using a string as the second argument gets considered.
|
857
854
|
* @since v10.0.0
|
858
855
|
*/
|
859
856
|
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
|
@@ -867,9 +864,9 @@ declare module "assert" {
|
|
867
864
|
* calls the function and awaits the returned promise to complete. It will then
|
868
865
|
* check that the promise is not rejected.
|
869
866
|
*
|
870
|
-
* If `asyncFn` is a function and it throws an error synchronously
|
867
|
+
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
871
868
|
* the function does not return a promise, `assert.doesNotReject()` will return a
|
872
|
-
* rejected `Promise` with an
|
869
|
+
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value) error. In both cases
|
873
870
|
* the error handler is skipped.
|
874
871
|
*
|
875
872
|
* Using `assert.doesNotReject()` is actually not useful because there is little
|
@@ -929,10 +926,10 @@ declare module "assert" {
|
|
929
926
|
* // OK
|
930
927
|
* ```
|
931
928
|
*
|
932
|
-
* If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
|
929
|
+
* If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
933
930
|
* to the value of the `message` parameter. If the `message` parameter is
|
934
931
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
935
|
-
* instance of an
|
932
|
+
* instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
936
933
|
* @since v13.6.0, v12.16.0
|
937
934
|
*/
|
938
935
|
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
@@ -952,10 +949,10 @@ declare module "assert" {
|
|
952
949
|
* // OK
|
953
950
|
* ```
|
954
951
|
*
|
955
|
-
* If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
|
952
|
+
* If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
956
953
|
* to the value of the `message` parameter. If the `message` parameter is
|
957
954
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
958
|
-
* instance of an
|
955
|
+
* instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
959
956
|
* @since v13.6.0, v12.16.0
|
960
957
|
*/
|
961
958
|
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
node/async_hooks.d.ts
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
* We strongly discourage the use of the `async_hooks` API.
|
3
3
|
* Other APIs that can cover most of its use cases include:
|
4
4
|
*
|
5
|
-
* * `AsyncLocalStorage` tracks async context
|
6
|
-
* * `process.getActiveResourcesInfo()` tracks active resources
|
5
|
+
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v20.x/api/async_context.html#class-asynclocalstorage) tracks async context
|
6
|
+
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v20.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
|
7
7
|
*
|
8
8
|
* The `node:async_hooks` module provides an API to track asynchronous resources.
|
9
9
|
* It can be accessed using:
|
@@ -12,7 +12,7 @@
|
|
12
12
|
* import async_hooks from 'node:async_hooks';
|
13
13
|
* ```
|
14
14
|
* @experimental
|
15
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
15
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/async_hooks.js)
|
16
16
|
*/
|
17
17
|
declare module "async_hooks" {
|
18
18
|
/**
|
@@ -44,7 +44,7 @@ declare module "async_hooks" {
|
|
44
44
|
* ```
|
45
45
|
*
|
46
46
|
* Promise contexts may not get precise `executionAsyncIds` by default.
|
47
|
-
* See the section on
|
47
|
+
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
|
48
48
|
* @since v8.1.0
|
49
49
|
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
50
50
|
*/
|
@@ -117,17 +117,17 @@ declare module "async_hooks" {
|
|
117
117
|
* ```
|
118
118
|
*
|
119
119
|
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
120
|
-
* the section on
|
120
|
+
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
|
121
121
|
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
122
122
|
*/
|
123
123
|
function triggerAsyncId(): number;
|
124
124
|
interface HookCallbacks {
|
125
125
|
/**
|
126
126
|
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
127
|
-
* @param asyncId
|
128
|
-
* @param type
|
129
|
-
* @param triggerAsyncId
|
130
|
-
* @param resource
|
127
|
+
* @param asyncId A unique ID for the async resource
|
128
|
+
* @param type The type of the async resource
|
129
|
+
* @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
|
130
|
+
* @param resource Reference to the resource representing the async operation, needs to be released during destroy
|
131
131
|
*/
|
132
132
|
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
133
133
|
/**
|
@@ -137,7 +137,9 @@ declare module "async_hooks" {
|
|
137
137
|
*/
|
138
138
|
before?(asyncId: number): void;
|
139
139
|
/**
|
140
|
-
* Called immediately after the callback specified in before is completed.
|
140
|
+
* Called immediately after the callback specified in `before` is completed.
|
141
|
+
*
|
142
|
+
* If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
|
141
143
|
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
142
144
|
*/
|
143
145
|
after?(asyncId: number): void;
|
@@ -321,7 +323,7 @@ declare module "async_hooks" {
|
|
321
323
|
/**
|
322
324
|
* This class creates stores that stay coherent through asynchronous operations.
|
323
325
|
*
|
324
|
-
* While you can create your own implementation on top of the `node:async_hooks`module, `AsyncLocalStorage` should be preferred as it is a performant and memory
|
326
|
+
* While you can create your own implementation on top of the `node:async_hooks` module, `AsyncLocalStorage` should be preferred as it is a performant and memory
|
325
327
|
* safe implementation that involves significant optimizations that are non-obvious
|
326
328
|
* to implement.
|
327
329
|
*
|
@@ -407,12 +409,12 @@ declare module "async_hooks" {
|
|
407
409
|
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
|
408
410
|
/**
|
409
411
|
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
|
410
|
-
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
|
412
|
+
* to `asyncLocalStorage.getStore()` will return `undefined` until `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
|
411
413
|
*
|
412
414
|
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
413
415
|
* instance will be exited.
|
414
416
|
*
|
415
|
-
* Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
|
417
|
+
* Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores
|
416
418
|
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
417
419
|
* along with the corresponding async resources.
|
418
420
|
*
|
@@ -465,7 +467,7 @@ declare module "async_hooks" {
|
|
465
467
|
/**
|
466
468
|
* Runs a function synchronously outside of a context and returns its
|
467
469
|
* return value. The store is not accessible within the callback function or
|
468
|
-
* the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
|
470
|
+
* the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`.
|
469
471
|
*
|
470
472
|
* The optional `args` are passed to the callback function.
|
471
473
|
*
|
@@ -511,7 +513,7 @@ declare module "async_hooks" {
|
|
511
513
|
* This transition will continue for the _entire_ synchronous execution.
|
512
514
|
* This means that if, for example, the context is entered within an event
|
513
515
|
* handler subsequent event handlers will also run within that context unless
|
514
|
-
* specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
|
516
|
+
* specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons
|
515
517
|
* to use the latter method.
|
516
518
|
*
|
517
519
|
* ```js
|
node/buffer.d.ts
CHANGED
@@ -41,7 +41,7 @@
|
|
41
41
|
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
42
42
|
* const buf7 = Buffer.from('tést', 'latin1');
|
43
43
|
* ```
|
44
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
44
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/buffer.js)
|
45
45
|
*/
|
46
46
|
declare module "buffer" {
|
47
47
|
import { BinaryLike } from "node:crypto";
|
@@ -311,12 +311,12 @@ declare module "buffer" {
|
|
311
311
|
*
|
312
312
|
* If `array` is an `Array`\-like object (that is, one with a `length` property of
|
313
313
|
* type `number`), it is treated as if it is an array, unless it is a `Buffer` or
|
314
|
-
* a `Uint8Array`. This means all other `TypedArray` variants get treated as an`Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`.
|
314
|
+
* a `Uint8Array`. This means all other `TypedArray` variants get treated as an `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`.
|
315
315
|
*
|
316
316
|
* A `TypeError` will be thrown if `array` is not an `Array` or another type
|
317
317
|
* appropriate for `Buffer.from()` variants.
|
318
318
|
*
|
319
|
-
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does.
|
319
|
+
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
320
320
|
* @since v5.10.0
|
321
321
|
*/
|
322
322
|
from(
|
@@ -420,9 +420,9 @@ declare module "buffer" {
|
|
420
420
|
encoding?: BufferEncoding,
|
421
421
|
): number;
|
422
422
|
/**
|
423
|
-
* Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together.
|
423
|
+
* Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
|
424
424
|
*
|
425
|
-
* If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned.
|
425
|
+
* If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
|
426
426
|
*
|
427
427
|
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
|
428
428
|
* in `list` by adding their lengths.
|
@@ -476,7 +476,7 @@ declare module "buffer" {
|
|
476
476
|
*/
|
477
477
|
copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
|
478
478
|
/**
|
479
|
-
* Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
|
479
|
+
* Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
|
480
480
|
*
|
481
481
|
* ```js
|
482
482
|
* import { Buffer } from 'node:buffer';
|
@@ -2098,7 +2098,7 @@ declare module "buffer" {
|
|
2098
2098
|
* // Prints: 6
|
2099
2099
|
* ```
|
2100
2100
|
*
|
2101
|
-
* If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value,
|
2101
|
+
* If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
|
2102
2102
|
* an integer between 0 and 255.
|
2103
2103
|
*
|
2104
2104
|
* If `byteOffset` is not a number, it will be coerced to a number. If the result
|
node/child_process.d.ts
CHANGED
@@ -63,7 +63,7 @@
|
|
63
63
|
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
|
64
64
|
* the synchronous methods can have significant impact on performance due to
|
65
65
|
* stalling the event loop while spawned processes complete.
|
66
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
66
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/child_process.js)
|
67
67
|
*/
|
68
68
|
declare module "child_process" {
|
69
69
|
import { ObjectEncodingOptions } from "node:fs";
|
node/cluster.d.ts
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
* ```
|
51
51
|
*
|
52
52
|
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
53
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
53
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/cluster.js)
|
54
54
|
*/
|
55
55
|
declare module "cluster" {
|
56
56
|
import * as child from "node:child_process";
|
node/console.d.ts
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
* myConsole.warn(`Danger ${name}! Danger!`);
|
55
55
|
* // Prints: Danger Will Robinson! Danger!, to err
|
56
56
|
* ```
|
57
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.12.
|
57
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/console.js)
|
58
58
|
*/
|
59
59
|
declare module "console" {
|
60
60
|
import console = require("node:console");
|
node/crypto.d.ts
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
* // Prints:
|
15
15
|
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
|
16
16
|
* ```
|
17
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
17
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/crypto.js)
|
18
18
|
*/
|
19
19
|
declare module "crypto" {
|
20
20
|
import * as stream from "node:stream";
|
@@ -27,7 +27,7 @@ declare module "crypto" {
|
|
27
27
|
* should not use this element anymore.
|
28
28
|
*
|
29
29
|
* The `node:crypto` module provides the `Certificate` class for working with SPKAC
|
30
|
-
* data. The most common usage is handling output generated by the HTML5`<keygen>` element. Node.js uses [OpenSSL's SPKAC
|
30
|
+
* data. The most common usage is handling output generated by the HTML5 `<keygen>` element. Node.js uses [OpenSSL's SPKAC
|
31
31
|
* implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally.
|
32
32
|
* @since v0.11.8
|
33
33
|
*/
|
@@ -3344,7 +3344,7 @@ declare module "crypto" {
|
|
3344
3344
|
callback: (error: Error | null, data: Buffer) => void,
|
3345
3345
|
): void;
|
3346
3346
|
/**
|
3347
|
-
* Verifies the given signature for `data` using the given key and algorithm. If`algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
|
3347
|
+
* Verifies the given signature for `data` using the given key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
|
3348
3348
|
* key type (especially Ed25519 and Ed448).
|
3349
3349
|
*
|
3350
3350
|
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
@@ -3378,6 +3378,41 @@ declare module "crypto" {
|
|
3378
3378
|
* @since v13.9.0, v12.17.0
|
3379
3379
|
*/
|
3380
3380
|
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
|
3381
|
+
/**
|
3382
|
+
* A utility for creating one-shot hash digests of data. It can be faster than the object-based `crypto.createHash()` when hashing a smaller amount of data
|
3383
|
+
* (<= 5MB) that's readily available. If the data can be big or if it is streamed, it's still recommended to use `crypto.createHash()` instead. The `algorithm`
|
3384
|
+
* is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases
|
3385
|
+
* of OpenSSL, `openssl list -digest-algorithms` will display the available digest algorithms.
|
3386
|
+
*
|
3387
|
+
* Example:
|
3388
|
+
*
|
3389
|
+
* ```js
|
3390
|
+
* const crypto = require('node:crypto');
|
3391
|
+
* const { Buffer } = require('node:buffer');
|
3392
|
+
*
|
3393
|
+
* // Hashing a string and return the result as a hex-encoded string.
|
3394
|
+
* const string = 'Node.js';
|
3395
|
+
* // 10b3493287f831e81a438811a1ffba01f8cec4b7
|
3396
|
+
* console.log(crypto.hash('sha1', string));
|
3397
|
+
*
|
3398
|
+
* // Encode a base64-encoded string into a Buffer, hash it and return
|
3399
|
+
* // the result as a buffer.
|
3400
|
+
* const base64 = 'Tm9kZS5qcw==';
|
3401
|
+
* // <Buffer 10 b3 49 32 87 f8 31 e8 1a 43 88 11 a1 ff ba 01 f8 ce c4 b7>
|
3402
|
+
* console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer'));
|
3403
|
+
* ```
|
3404
|
+
* @since v21.7.0, v20.12.0
|
3405
|
+
* @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different input encoding is desired for a string input, user
|
3406
|
+
* could encode the string into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing the encoded `TypedArray` into this API instead.
|
3407
|
+
* @param [outputEncoding='hex'] [Encoding](https://nodejs.org/docs/latest-v20.x/api/buffer.html#buffers-and-character-encodings) used to encode the returned digest.
|
3408
|
+
*/
|
3409
|
+
function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
|
3410
|
+
function hash(algorithm: string, data: BinaryLike, outputEncoding: "buffer"): Buffer;
|
3411
|
+
function hash(
|
3412
|
+
algorithm: string,
|
3413
|
+
data: BinaryLike,
|
3414
|
+
outputEncoding?: BinaryToTextEncoding | "buffer",
|
3415
|
+
): string | Buffer;
|
3381
3416
|
type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
|
3382
3417
|
interface CipherInfoOptions {
|
3383
3418
|
/**
|
node/dgram.d.ts
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
* server.bind(41234);
|
24
24
|
* // Prints: server listening 0.0.0.0:41234
|
25
25
|
* ```
|
26
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
26
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/dgram.js)
|
27
27
|
*/
|
28
28
|
declare module "dgram" {
|
29
29
|
import { AddressInfo } from "node:net";
|
@@ -66,7 +66,7 @@ declare module "dgram" {
|
|
66
66
|
* (it does the right thing for both `udp4` and `udp6` sockets). The bound address
|
67
67
|
* and port can be retrieved using `socket.address().address` and `socket.address().port`.
|
68
68
|
*
|
69
|
-
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket:
|
69
|
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.close()` on the socket:
|
70
70
|
*
|
71
71
|
* ```js
|
72
72
|
* const controller = new AbortController();
|
@@ -93,7 +93,7 @@ declare module "dgram" {
|
|
93
93
|
*/
|
94
94
|
class Socket extends EventEmitter {
|
95
95
|
/**
|
96
|
-
* Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not
|
96
|
+
* Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not
|
97
97
|
* specified, the operating system will choose
|
98
98
|
* one interface and will add membership to it. To add membership to every
|
99
99
|
* available interface, call `addMembership` multiple times, once per interface.
|
@@ -122,7 +122,7 @@ declare module "dgram" {
|
|
122
122
|
addMembership(multicastAddress: string, multicastInterface?: string): void;
|
123
123
|
/**
|
124
124
|
* Returns an object containing the address information for a socket.
|
125
|
-
* For UDP sockets, this object will contain `address`, `family`, and `port`properties.
|
125
|
+
* For UDP sockets, this object will contain `address`, `family`, and `port` properties.
|
126
126
|
*
|
127
127
|
* This method throws `EBADF` if called on an unbound socket.
|
128
128
|
* @since v0.1.99
|
@@ -133,10 +133,10 @@ declare module "dgram" {
|
|
133
133
|
* messages on a named `port` and optional `address`. If `port` is not
|
134
134
|
* specified or is `0`, the operating system will attempt to bind to a
|
135
135
|
* random port. If `address` is not specified, the operating system will
|
136
|
-
* attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is
|
136
|
+
* attempt to listen on all addresses. Once binding is complete, a `'listening'` event is emitted and the optional `callback` function is
|
137
137
|
* called.
|
138
138
|
*
|
139
|
-
* Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very
|
139
|
+
* Specifying both a `'listening'` event listener and passing a `callback` to the `socket.bind()` method is not harmful but not very
|
140
140
|
* useful.
|
141
141
|
*
|
142
142
|
* A bound datagram socket keeps the Node.js process running to receive
|
@@ -206,7 +206,7 @@ declare module "dgram" {
|
|
206
206
|
*/
|
207
207
|
disconnect(): void;
|
208
208
|
/**
|
209
|
-
* Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
|
209
|
+
* Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
|
210
210
|
* kernel when the socket is closed or the process terminates, so most apps will
|
211
211
|
* never have reason to call this.
|
212
212
|
*
|
@@ -269,7 +269,7 @@ declare module "dgram" {
|
|
269
269
|
* any `TypedArray` or a `DataView`,
|
270
270
|
* the `offset` and `length` specify the offset within the `Buffer` where the
|
271
271
|
* message begins and the number of bytes in the message, respectively.
|
272
|
-
* If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that
|
272
|
+
* If `msg` is a `String`, then it is automatically converted to a `Buffer` with `'utf8'` encoding. With messages that
|
273
273
|
* contain multi-byte characters, `offset` and `length` will be calculated with
|
274
274
|
* respect to `byte length` and not the character position.
|
275
275
|
* If `msg` is an array, `offset` and `length` must not be specified.
|
@@ -287,7 +287,7 @@ declare module "dgram" {
|
|
287
287
|
* DNS lookups delay the time to send for at least one tick of the
|
288
288
|
* Node.js event loop.
|
289
289
|
*
|
290
|
-
* The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be
|
290
|
+
* The only way to know for sure that the datagram has been sent is by using a `callback`. If an error occurs and a `callback` is given, the error will be
|
291
291
|
* passed as the first argument to the `callback`. If a `callback` is not given,
|
292
292
|
* the error is emitted as an `'error'` event on the `socket` object.
|
293
293
|
*
|
@@ -329,7 +329,7 @@ declare module "dgram" {
|
|
329
329
|
* determine the optimal strategy on a case-by-case basis. Generally speaking,
|
330
330
|
* however, sending multiple buffers is faster.
|
331
331
|
*
|
332
|
-
* Example of sending a UDP packet using a socket connected to a port on`localhost`:
|
332
|
+
* Example of sending a UDP packet using a socket connected to a port on `localhost`:
|
333
333
|
*
|
334
334
|
* ```js
|
335
335
|
* import dgram from 'node:dgram';
|
@@ -519,10 +519,10 @@ declare module "dgram" {
|
|
519
519
|
*/
|
520
520
|
unref(): this;
|
521
521
|
/**
|
522
|
-
* Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket
|
522
|
+
* Tells the kernel to join a source-specific multicast channel at the given `sourceAddress` and `groupAddress`, using the `multicastInterface` with the `IP_ADD_SOURCE_MEMBERSHIP` socket
|
523
523
|
* option. If the `multicastInterface` argument
|
524
524
|
* is not specified, the operating system will choose one interface and will add
|
525
|
-
* membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface.
|
525
|
+
* membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface.
|
526
526
|
*
|
527
527
|
* When called on an unbound socket, this method will implicitly bind to a random
|
528
528
|
* port, listening on all interfaces.
|
@@ -530,7 +530,7 @@ declare module "dgram" {
|
|
530
530
|
*/
|
531
531
|
addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
|
532
532
|
/**
|
533
|
-
* Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is
|
533
|
+
* Instructs the kernel to leave a source-specific multicast channel at the given `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` socket option. This method is
|
534
534
|
* automatically called by the kernel when the
|
535
535
|
* socket is closed or the process terminates, so most apps will never have
|
536
536
|
* reason to call this.
|