@types/node 16.18.110 → 16.18.112
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 v16.18/README.md +1 -1
- node v16.18/buffer.buffer.d.ts +365 -0
- node v16.18/buffer.d.ts +8 -362
- node v16.18/child_process.d.ts +34 -29
- node v16.18/cluster.d.ts +1 -1
- node v16.18/console.d.ts +2 -2
- node v16.18/crypto.d.ts +1 -1
- node v16.18/dns/promises.d.ts +6 -5
- node v16.18/dns.d.ts +5 -5
- node v16.18/domain.d.ts +2 -2
- node v16.18/events.d.ts +13 -13
- node v16.18/fs/promises.d.ts +2 -2
- node v16.18/fs.d.ts +1 -1
- node v16.18/globals.d.ts +0 -14
- node v16.18/globals.typedarray.d.ts +21 -0
- node v16.18/http.d.ts +2 -2
- node v16.18/http2.d.ts +24 -24
- node v16.18/https.d.ts +9 -9
- node v16.18/index.d.ts +5 -1
- node v16.18/inspector.d.ts +1 -1
- node v16.18/module.d.ts +3 -3
- node v16.18/net.d.ts +2 -2
- node v16.18/os.d.ts +1 -1
- node v16.18/package.json +9 -2
- node v16.18/path.d.ts +1 -1
- node v16.18/perf_hooks.d.ts +11 -11
- node v16.18/punycode.d.ts +1 -1
- node v16.18/querystring.d.ts +1 -1
- node v16.18/readline.d.ts +12 -12
- node v16.18/repl.d.ts +4 -4
- node v16.18/stream.d.ts +18 -18
- node v16.18/string_decoder.d.ts +3 -3
- node v16.18/timers/promises.d.ts +1 -1
- node v16.18/timers.d.ts +1 -1
- node v16.18/tls.d.ts +5 -5
- node v16.18/trace_events.d.ts +3 -3
- node v16.18/ts5.6/buffer.buffer.d.ts +365 -0
- node v16.18/ts5.6/globals.typedarray.d.ts +19 -0
- node v16.18/ts5.6/index.d.ts +90 -0
- node v16.18/tty.d.ts +1 -1
- node v16.18/url.d.ts +6 -6
- node v16.18/util.d.ts +40 -40
- node v16.18/v8.d.ts +11 -11
- node v16.18/vm.d.ts +11 -12
- node v16.18/worker_threads.d.ts +19 -19
- node v16.18/zlib.d.ts +8 -8
node v16.18/console.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
|
|
8
8
|
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v16.x/api/process.html#processstdout) and
|
|
9
|
-
* [`process.stderr`](https://nodejs.org/docs/latest-v16.x/api/process.html#processstderr). The global `console` can be used without
|
|
9
|
+
* [`process.stderr`](https://nodejs.org/docs/latest-v16.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
|
10
10
|
*
|
|
11
11
|
* _**Warning**_: The global console object's methods are neither consistently
|
|
12
12
|
* synchronous like the browser APIs they resemble, nor are they consistently
|
|
@@ -362,7 +362,7 @@ declare module "node:console" {
|
|
|
362
362
|
*
|
|
363
363
|
* * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.
|
|
364
364
|
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v16.x/api/process.html#processstdout) and
|
|
365
|
-
* [`process.stderr`](https://nodejs.org/docs/latest-v16.x/api/process.html#processstderr). The global `console` can be used without
|
|
365
|
+
* [`process.stderr`](https://nodejs.org/docs/latest-v16.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
|
366
366
|
*
|
|
367
367
|
* _**Warning**_: The global console object's methods are neither consistently
|
|
368
368
|
* synchronous like the browser APIs they resemble, nor are they consistently
|
node v16.18/crypto.d.ts
CHANGED
|
@@ -3957,7 +3957,7 @@ declare module "crypto" {
|
|
|
3957
3957
|
saltLength: number;
|
|
3958
3958
|
}
|
|
3959
3959
|
/**
|
|
3960
|
-
*
|
|
3960
|
+
* Importing the `webcrypto` object (`import { webcrypto } from 'node:crypto'`) gives an instance of the `Crypto` class.
|
|
3961
3961
|
* `Crypto` is a singleton that provides access to the remainder of the crypto API.
|
|
3962
3962
|
* @since v15.0.0
|
|
3963
3963
|
*/
|
node v16.18/dns/promises.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `dns.promises` API provides an alternative set of asynchronous DNS methods
|
|
3
3
|
* that return `Promise` objects rather than using callbacks. The API is accessible
|
|
4
|
-
* via `
|
|
4
|
+
* via `import { promises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`.
|
|
5
5
|
* @since v10.6.0
|
|
6
6
|
*/
|
|
7
7
|
declare module "dns/promises" {
|
|
@@ -60,7 +60,7 @@ declare module "dns/promises" {
|
|
|
60
60
|
* Example usage:
|
|
61
61
|
*
|
|
62
62
|
* ```js
|
|
63
|
-
*
|
|
63
|
+
* import dns from 'node:dns';
|
|
64
64
|
* const dnsPromises = dns.promises;
|
|
65
65
|
* const options = {
|
|
66
66
|
* family: 6,
|
|
@@ -96,8 +96,8 @@ declare module "dns/promises" {
|
|
|
96
96
|
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v16.x/api/errors.html#class-error) object, where `err.code` is the error code.
|
|
97
97
|
*
|
|
98
98
|
* ```js
|
|
99
|
-
*
|
|
100
|
-
*
|
|
99
|
+
* import dns from 'node:dns';
|
|
100
|
+
* dns.promises.lookupService('127.0.0.1', 22).then((result) => {
|
|
101
101
|
* console.log(result.hostname, result.service);
|
|
102
102
|
* // Prints: localhost ssh
|
|
103
103
|
* });
|
|
@@ -383,7 +383,8 @@ declare module "dns/promises" {
|
|
|
383
383
|
* other resolvers:
|
|
384
384
|
*
|
|
385
385
|
* ```js
|
|
386
|
-
*
|
|
386
|
+
* import dns from 'node:dns';
|
|
387
|
+
* const { Resolver } = dns.promises;
|
|
387
388
|
* const resolver = new Resolver();
|
|
388
389
|
* resolver.setServers(['4.4.4.4']);
|
|
389
390
|
*
|
node v16.18/dns.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* system do, use {@link lookup}.
|
|
10
10
|
*
|
|
11
11
|
* ```js
|
|
12
|
-
*
|
|
12
|
+
* import dns from 'node:dns';
|
|
13
13
|
*
|
|
14
14
|
* dns.lookup('example.org', (err, address, family) => {
|
|
15
15
|
* console.log('address: %j family: IPv%s', address, family);
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* DNS queries, bypassing other name-resolution facilities.
|
|
24
24
|
*
|
|
25
25
|
* ```js
|
|
26
|
-
*
|
|
26
|
+
* import dns from 'node:dns';
|
|
27
27
|
*
|
|
28
28
|
* dns.resolve4('archive.org', (err, addresses) => {
|
|
29
29
|
* if (err) throw err;
|
|
@@ -129,7 +129,7 @@ declare module "dns" {
|
|
|
129
129
|
* Example usage:
|
|
130
130
|
*
|
|
131
131
|
* ```js
|
|
132
|
-
*
|
|
132
|
+
* import dns from 'node:dns';
|
|
133
133
|
* const options = {
|
|
134
134
|
* family: 6,
|
|
135
135
|
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
|
@@ -189,7 +189,7 @@ declare module "dns" {
|
|
|
189
189
|
* where `err.code` is the error code.
|
|
190
190
|
*
|
|
191
191
|
* ```js
|
|
192
|
-
*
|
|
192
|
+
* import dns from 'node:dns';
|
|
193
193
|
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
|
|
194
194
|
* console.log(hostname, service);
|
|
195
195
|
* // Prints: localhost ssh
|
|
@@ -766,7 +766,7 @@ declare module "dns" {
|
|
|
766
766
|
* other resolvers:
|
|
767
767
|
*
|
|
768
768
|
* ```js
|
|
769
|
-
*
|
|
769
|
+
* import { Resolver } from 'node:dns';
|
|
770
770
|
* const resolver = new Resolver();
|
|
771
771
|
* resolver.setServers(['4.4.4.4']);
|
|
772
772
|
*
|
node v16.18/domain.d.ts
CHANGED
|
@@ -63,8 +63,8 @@ declare module "domain" {
|
|
|
63
63
|
* This is the most basic way to use a domain.
|
|
64
64
|
*
|
|
65
65
|
* ```js
|
|
66
|
-
*
|
|
67
|
-
*
|
|
66
|
+
* import domain from 'node:domain';
|
|
67
|
+
* import fs from 'node:fs';
|
|
68
68
|
* const d = domain.create();
|
|
69
69
|
* d.on('error', (er) => {
|
|
70
70
|
* console.error('Caught error!', er);
|
node v16.18/events.d.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* the `eventEmitter.emit()` method is used to trigger the event.
|
|
23
23
|
*
|
|
24
24
|
* ```js
|
|
25
|
-
*
|
|
25
|
+
* import EventEmitter from 'node:events';
|
|
26
26
|
*
|
|
27
27
|
* class MyEmitter extends EventEmitter {}
|
|
28
28
|
*
|
|
@@ -79,7 +79,7 @@ declare module "events" {
|
|
|
79
79
|
* The `EventEmitter` class is defined and exposed by the `events` module:
|
|
80
80
|
*
|
|
81
81
|
* ```js
|
|
82
|
-
*
|
|
82
|
+
* import EventEmitter from 'node:events';
|
|
83
83
|
* ```
|
|
84
84
|
*
|
|
85
85
|
* All `EventEmitter`s emit the event `'newListener'` when new listeners are
|
|
@@ -103,7 +103,7 @@ declare module "events" {
|
|
|
103
103
|
* semantics and does not listen to the `'error'` event.
|
|
104
104
|
*
|
|
105
105
|
* ```js
|
|
106
|
-
*
|
|
106
|
+
* import { once, EventEmitter } from 'node:events';
|
|
107
107
|
*
|
|
108
108
|
* async function run() {
|
|
109
109
|
* const ee = new EventEmitter();
|
|
@@ -135,7 +135,7 @@ declare module "events" {
|
|
|
135
135
|
* special handling:
|
|
136
136
|
*
|
|
137
137
|
* ```js
|
|
138
|
-
*
|
|
138
|
+
* import { EventEmitter, once } from 'node:events';
|
|
139
139
|
*
|
|
140
140
|
* const ee = new EventEmitter();
|
|
141
141
|
*
|
|
@@ -151,7 +151,7 @@ declare module "events" {
|
|
|
151
151
|
* An `AbortSignal` can be used to cancel waiting for the event:
|
|
152
152
|
*
|
|
153
153
|
* ```js
|
|
154
|
-
*
|
|
154
|
+
* import { EventEmitter, once } from 'node:events';
|
|
155
155
|
*
|
|
156
156
|
* const ee = new EventEmitter();
|
|
157
157
|
* const ac = new AbortController();
|
|
@@ -183,7 +183,7 @@ declare module "events" {
|
|
|
183
183
|
static once(emitter: DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
|
|
184
184
|
/**
|
|
185
185
|
* ```js
|
|
186
|
-
*
|
|
186
|
+
* import { on, EventEmitter } from 'node:events';
|
|
187
187
|
*
|
|
188
188
|
* (async () => {
|
|
189
189
|
* const ee = new EventEmitter();
|
|
@@ -212,7 +212,7 @@ declare module "events" {
|
|
|
212
212
|
* An `AbortSignal` can be used to cancel waiting on events:
|
|
213
213
|
*
|
|
214
214
|
* ```js
|
|
215
|
-
*
|
|
215
|
+
* import { on, EventEmitter } from 'node:events';
|
|
216
216
|
* const ac = new AbortController();
|
|
217
217
|
*
|
|
218
218
|
* (async () => {
|
|
@@ -248,7 +248,7 @@ declare module "events" {
|
|
|
248
248
|
* A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
|
|
249
249
|
*
|
|
250
250
|
* ```js
|
|
251
|
-
*
|
|
251
|
+
* import { EventEmitter, listenerCount } from 'node:events';
|
|
252
252
|
* const myEmitter = new EventEmitter();
|
|
253
253
|
* myEmitter.on('event', () => {});
|
|
254
254
|
* myEmitter.on('event', () => {});
|
|
@@ -271,7 +271,7 @@ declare module "events" {
|
|
|
271
271
|
* event target. This is useful for debugging and diagnostic purposes.
|
|
272
272
|
*
|
|
273
273
|
* ```js
|
|
274
|
-
*
|
|
274
|
+
* import { getEventListeners, EventEmitter } from 'node:events';
|
|
275
275
|
*
|
|
276
276
|
* {
|
|
277
277
|
* const ee = new EventEmitter();
|
|
@@ -291,10 +291,10 @@ declare module "events" {
|
|
|
291
291
|
static getEventListeners(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
|
|
292
292
|
/**
|
|
293
293
|
* ```js
|
|
294
|
-
*
|
|
294
|
+
* import {
|
|
295
295
|
* setMaxListeners,
|
|
296
296
|
* EventEmitter
|
|
297
|
-
* }
|
|
297
|
+
* } from 'node:events';
|
|
298
298
|
*
|
|
299
299
|
* const target = new EventTarget();
|
|
300
300
|
* const emitter = new EventEmitter();
|
|
@@ -610,7 +610,7 @@ declare module "events" {
|
|
|
610
610
|
* Returns `true` if the event had listeners, `false` otherwise.
|
|
611
611
|
*
|
|
612
612
|
* ```js
|
|
613
|
-
*
|
|
613
|
+
* import EventEmitter from 'node:events';
|
|
614
614
|
* const myEmitter = new EventEmitter();
|
|
615
615
|
*
|
|
616
616
|
* // First listener
|
|
@@ -689,7 +689,7 @@ declare module "events" {
|
|
|
689
689
|
* listeners. The values in the array are strings or `Symbol`s.
|
|
690
690
|
*
|
|
691
691
|
* ```js
|
|
692
|
-
*
|
|
692
|
+
* import EventEmitter from 'node:events';
|
|
693
693
|
* const myEE = new EventEmitter();
|
|
694
694
|
* myEE.on('foo', () => {});
|
|
695
695
|
* myEE.on('bar', () => {});
|
node v16.18/fs/promises.d.ts
CHANGED
|
@@ -830,7 +830,7 @@ declare module "fs/promises" {
|
|
|
830
830
|
* The `fsPromises.mkdtemp()` method will append the six randomly selected
|
|
831
831
|
* characters directly to the `prefix` string. For instance, given a directory`/tmp`, if the intention is to create a temporary directory _within_`/tmp`, the`prefix` must end with a trailing
|
|
832
832
|
* platform-specific path separator
|
|
833
|
-
* (`
|
|
833
|
+
* (`import { sep } from 'node:path'`).
|
|
834
834
|
* @since v10.0.0
|
|
835
835
|
* @return Fulfills with a string containing the filesystem path of the newly created temporary directory.
|
|
836
836
|
*/
|
|
@@ -1050,7 +1050,7 @@ declare module "fs/promises" {
|
|
|
1050
1050
|
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
|
|
1051
1051
|
*
|
|
1052
1052
|
* ```js
|
|
1053
|
-
*
|
|
1053
|
+
* import { watch } from 'node:fs/promises';
|
|
1054
1054
|
*
|
|
1055
1055
|
* const ac = new AbortController();
|
|
1056
1056
|
* const { signal } = ac;
|
node v16.18/fs.d.ts
CHANGED
|
@@ -1747,7 +1747,7 @@ declare module "fs" {
|
|
|
1747
1747
|
* The `fs.mkdtemp()` method will append the six randomly selected characters
|
|
1748
1748
|
* directly to the `prefix` string. For instance, given a directory `/tmp`, if the
|
|
1749
1749
|
* intention is to create a temporary directory _within_`/tmp`, the `prefix`must end with a trailing platform-specific path separator
|
|
1750
|
-
* (`
|
|
1750
|
+
* (`import { sep } from 'node:path'`).
|
|
1751
1751
|
*
|
|
1752
1752
|
* ```js
|
|
1753
1753
|
* import { tmpdir } from 'os';
|
node v16.18/globals.d.ts
CHANGED
|
@@ -224,20 +224,6 @@ declare namespace NodeJS {
|
|
|
224
224
|
unref(): this;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
type TypedArray =
|
|
228
|
-
| Uint8Array
|
|
229
|
-
| Uint8ClampedArray
|
|
230
|
-
| Uint16Array
|
|
231
|
-
| Uint32Array
|
|
232
|
-
| Int8Array
|
|
233
|
-
| Int16Array
|
|
234
|
-
| Int32Array
|
|
235
|
-
| BigUint64Array
|
|
236
|
-
| BigInt64Array
|
|
237
|
-
| Float32Array
|
|
238
|
-
| Float64Array;
|
|
239
|
-
type ArrayBufferView = TypedArray | DataView;
|
|
240
|
-
|
|
241
227
|
interface Require {
|
|
242
228
|
(id: string): any;
|
|
243
229
|
resolve: RequireResolve;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export {}; // Make this a module
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace NodeJS {
|
|
5
|
+
type TypedArray<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
|
|
6
|
+
| Uint8Array<TArrayBuffer>
|
|
7
|
+
| Uint8ClampedArray<TArrayBuffer>
|
|
8
|
+
| Uint16Array<TArrayBuffer>
|
|
9
|
+
| Uint32Array<TArrayBuffer>
|
|
10
|
+
| Int8Array<TArrayBuffer>
|
|
11
|
+
| Int16Array<TArrayBuffer>
|
|
12
|
+
| Int32Array<TArrayBuffer>
|
|
13
|
+
| BigUint64Array<TArrayBuffer>
|
|
14
|
+
| BigInt64Array<TArrayBuffer>
|
|
15
|
+
| Float32Array<TArrayBuffer>
|
|
16
|
+
| Float64Array<TArrayBuffer>;
|
|
17
|
+
type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
|
|
18
|
+
| TypedArray<TArrayBuffer>
|
|
19
|
+
| DataView<TArrayBuffer>;
|
|
20
|
+
}
|
|
21
|
+
}
|
node v16.18/http.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* To use the HTTP server and client one must `
|
|
2
|
+
* To use the HTTP server and client one must import the `node:http` module.
|
|
3
3
|
*
|
|
4
4
|
* The HTTP interfaces in Node.js are designed to support many features
|
|
5
5
|
* of the protocol which have been traditionally difficult to use.
|
|
@@ -1315,7 +1315,7 @@ declare module "http" {
|
|
|
1315
1315
|
* upload a file with a POST request, then write to the `ClientRequest` object.
|
|
1316
1316
|
*
|
|
1317
1317
|
* ```js
|
|
1318
|
-
*
|
|
1318
|
+
* import http from 'node:http';
|
|
1319
1319
|
*
|
|
1320
1320
|
* const postData = JSON.stringify({
|
|
1321
1321
|
* 'msg': 'Hello World!'
|
node v16.18/http2.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* It can be accessed using:
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
|
-
*
|
|
6
|
+
* import http2 from 'node:http2';
|
|
7
7
|
* ```
|
|
8
8
|
* @since v8.4.0
|
|
9
9
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/http2.js)
|
|
@@ -157,7 +157,7 @@ declare module "http2" {
|
|
|
157
157
|
priority(options: StreamPriorityOptions): void;
|
|
158
158
|
/**
|
|
159
159
|
* ```js
|
|
160
|
-
*
|
|
160
|
+
* import http2 from 'node:http2';
|
|
161
161
|
* const client = http2.connect('http://example.org:8000');
|
|
162
162
|
* const { NGHTTP2_CANCEL } = http2.constants;
|
|
163
163
|
* const req = client.request({ ':path': '/' });
|
|
@@ -177,7 +177,7 @@ declare module "http2" {
|
|
|
177
177
|
* trailers can be sent.
|
|
178
178
|
*
|
|
179
179
|
* ```js
|
|
180
|
-
*
|
|
180
|
+
* import http2 from 'node:http2';
|
|
181
181
|
* const server = http2.createServer();
|
|
182
182
|
* server.on('stream', (stream) => {
|
|
183
183
|
* stream.respond(undefined, { waitForTrailers: true });
|
|
@@ -368,7 +368,7 @@ declare module "http2" {
|
|
|
368
368
|
* Initiates a push stream. The callback is invoked with the new `Http2Stream` instance created for the push stream passed as the second argument, or an `Error` passed as the first argument.
|
|
369
369
|
*
|
|
370
370
|
* ```js
|
|
371
|
-
*
|
|
371
|
+
* import http2 from 'node:http2';
|
|
372
372
|
* const server = http2.createServer();
|
|
373
373
|
* server.on('stream', (stream) => {
|
|
374
374
|
* stream.respond({ ':status': 200 });
|
|
@@ -400,7 +400,7 @@ declare module "http2" {
|
|
|
400
400
|
): void;
|
|
401
401
|
/**
|
|
402
402
|
* ```js
|
|
403
|
-
*
|
|
403
|
+
* import http2 from 'node:http2';
|
|
404
404
|
* const server = http2.createServer();
|
|
405
405
|
* server.on('stream', (stream) => {
|
|
406
406
|
* stream.respond({ ':status': 200 });
|
|
@@ -416,7 +416,7 @@ declare module "http2" {
|
|
|
416
416
|
* close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
|
|
417
417
|
*
|
|
418
418
|
* ```js
|
|
419
|
-
*
|
|
419
|
+
* import http2 from 'node:http2';
|
|
420
420
|
* const server = http2.createServer();
|
|
421
421
|
* server.on('stream', (stream) => {
|
|
422
422
|
* stream.respond({ ':status': 200 }, { waitForTrailers: true });
|
|
@@ -439,8 +439,8 @@ declare module "http2" {
|
|
|
439
439
|
* automatically.
|
|
440
440
|
*
|
|
441
441
|
* ```js
|
|
442
|
-
*
|
|
443
|
-
*
|
|
442
|
+
* import http2 from 'node:http2';
|
|
443
|
+
* import fs from 'node:fs';
|
|
444
444
|
*
|
|
445
445
|
* const server = http2.createServer();
|
|
446
446
|
* server.on('stream', (stream) => {
|
|
@@ -482,8 +482,8 @@ declare module "http2" {
|
|
|
482
482
|
* or `http2stream.close()` to close the `Http2Stream`.
|
|
483
483
|
*
|
|
484
484
|
* ```js
|
|
485
|
-
*
|
|
486
|
-
*
|
|
485
|
+
* import http2 from 'node:http2';
|
|
486
|
+
* import fs from 'node:fs';
|
|
487
487
|
*
|
|
488
488
|
* const server = http2.createServer();
|
|
489
489
|
* server.on('stream', (stream) => {
|
|
@@ -529,7 +529,7 @@ declare module "http2" {
|
|
|
529
529
|
* Example using a file path:
|
|
530
530
|
*
|
|
531
531
|
* ```js
|
|
532
|
-
*
|
|
532
|
+
* import http2 from 'node:http2';
|
|
533
533
|
* const server = http2.createServer();
|
|
534
534
|
* server.on('stream', (stream) => {
|
|
535
535
|
* function statCheck(stat, headers) {
|
|
@@ -563,7 +563,7 @@ declare module "http2" {
|
|
|
563
563
|
* results to determine if the file has been modified to return an appropriate `304` response:
|
|
564
564
|
*
|
|
565
565
|
* ```js
|
|
566
|
-
*
|
|
566
|
+
* import http2 from 'node:http2';
|
|
567
567
|
* const server = http2.createServer();
|
|
568
568
|
* server.on('stream', (stream) => {
|
|
569
569
|
* function statCheck(stat, headers) {
|
|
@@ -596,7 +596,7 @@ declare module "http2" {
|
|
|
596
596
|
* close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
|
|
597
597
|
*
|
|
598
598
|
* ```js
|
|
599
|
-
*
|
|
599
|
+
* import http2 from 'node:http2';
|
|
600
600
|
* const server = http2.createServer();
|
|
601
601
|
* server.on('stream', (stream) => {
|
|
602
602
|
* stream.respondWithFile('/some/file',
|
|
@@ -805,7 +805,7 @@ declare module "http2" {
|
|
|
805
805
|
* the delta.
|
|
806
806
|
*
|
|
807
807
|
* ```js
|
|
808
|
-
*
|
|
808
|
+
* import http2 from 'node:http2';
|
|
809
809
|
*
|
|
810
810
|
* const server = http2.createServer();
|
|
811
811
|
* const expectedWindowSize = 2 ** 20;
|
|
@@ -927,7 +927,7 @@ declare module "http2" {
|
|
|
927
927
|
* This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`.
|
|
928
928
|
*
|
|
929
929
|
* ```js
|
|
930
|
-
*
|
|
930
|
+
* import http2 from 'node:http2';
|
|
931
931
|
* const clientSession = http2.connect('https://localhost:1234');
|
|
932
932
|
* const {
|
|
933
933
|
* HTTP2_HEADER_PATH,
|
|
@@ -1060,7 +1060,7 @@ declare module "http2" {
|
|
|
1060
1060
|
* Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
|
|
1061
1061
|
*
|
|
1062
1062
|
* ```js
|
|
1063
|
-
*
|
|
1063
|
+
* import http2 from 'node:http2';
|
|
1064
1064
|
*
|
|
1065
1065
|
* const server = http2.createServer();
|
|
1066
1066
|
* server.on('session', (session) => {
|
|
@@ -1101,7 +1101,7 @@ declare module "http2" {
|
|
|
1101
1101
|
* authoritative responses.
|
|
1102
1102
|
*
|
|
1103
1103
|
* ```js
|
|
1104
|
-
*
|
|
1104
|
+
* import http2 from 'node:http2';
|
|
1105
1105
|
* const options = getSecureOptionsSomehow();
|
|
1106
1106
|
* const server = http2.createSecureServer(options);
|
|
1107
1107
|
* server.on('stream', (stream) => {
|
|
@@ -1127,7 +1127,7 @@ declare module "http2" {
|
|
|
1127
1127
|
* server using the `http2.createSecureServer()` method:
|
|
1128
1128
|
*
|
|
1129
1129
|
* ```js
|
|
1130
|
-
*
|
|
1130
|
+
* import http2 from 'node:http2';
|
|
1131
1131
|
* const options = getSecureOptionsSomehow();
|
|
1132
1132
|
* options.origins = ['https://example.com', 'https://example.org'];
|
|
1133
1133
|
* const server = http2.createSecureServer(options);
|
|
@@ -1807,7 +1807,7 @@ declare module "http2" {
|
|
|
1807
1807
|
* All other interactions will be routed directly to the socket.
|
|
1808
1808
|
*
|
|
1809
1809
|
* ```js
|
|
1810
|
-
*
|
|
1810
|
+
* import http2 from 'node:http2';
|
|
1811
1811
|
* const server = http2.createServer((req, res) => {
|
|
1812
1812
|
* const ip = req.socket.remoteAddress;
|
|
1813
1813
|
* const port = req.socket.remotePort;
|
|
@@ -2358,7 +2358,7 @@ declare module "http2" {
|
|
|
2358
2358
|
* for use with the `HTTP2-Settings` header field.
|
|
2359
2359
|
*
|
|
2360
2360
|
* ```js
|
|
2361
|
-
*
|
|
2361
|
+
* import http2 from 'node:http2';
|
|
2362
2362
|
*
|
|
2363
2363
|
* const packed = http2.getPackedSettings({ enablePush: false });
|
|
2364
2364
|
*
|
|
@@ -2383,7 +2383,7 @@ declare module "http2" {
|
|
|
2383
2383
|
* with browser clients.
|
|
2384
2384
|
*
|
|
2385
2385
|
* ```js
|
|
2386
|
-
*
|
|
2386
|
+
* import http2 from 'node:http2';
|
|
2387
2387
|
*
|
|
2388
2388
|
* // Create an unencrypted HTTP/2 server.
|
|
2389
2389
|
* // Since there are no browsers known that support
|
|
@@ -2420,8 +2420,8 @@ declare module "http2" {
|
|
|
2420
2420
|
* Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
|
|
2421
2421
|
*
|
|
2422
2422
|
* ```js
|
|
2423
|
-
*
|
|
2424
|
-
*
|
|
2423
|
+
* import http2 from 'node:http2';
|
|
2424
|
+
* import fs from 'node:fs';
|
|
2425
2425
|
*
|
|
2426
2426
|
* const options = {
|
|
2427
2427
|
* key: fs.readFileSync('server-key.pem'),
|
|
@@ -2460,7 +2460,7 @@ declare module "http2" {
|
|
|
2460
2460
|
* Returns a `ClientHttp2Session` instance.
|
|
2461
2461
|
*
|
|
2462
2462
|
* ```js
|
|
2463
|
-
*
|
|
2463
|
+
* import http2 from 'node:http2';
|
|
2464
2464
|
* const client = http2.connect('https://localhost:1234');
|
|
2465
2465
|
*
|
|
2466
2466
|
* // Use the client
|
node v16.18/https.d.ts
CHANGED
|
@@ -260,8 +260,8 @@ declare module "https" {
|
|
|
260
260
|
/**
|
|
261
261
|
* ```js
|
|
262
262
|
* // curl -k https://localhost:8000/
|
|
263
|
-
*
|
|
264
|
-
*
|
|
263
|
+
* import https from 'node:https';
|
|
264
|
+
* import fs from 'node:fs';
|
|
265
265
|
*
|
|
266
266
|
* const options = {
|
|
267
267
|
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
|
|
@@ -277,8 +277,8 @@ declare module "https" {
|
|
|
277
277
|
* Or
|
|
278
278
|
*
|
|
279
279
|
* ```js
|
|
280
|
-
*
|
|
281
|
-
*
|
|
280
|
+
* import https from 'node:https';
|
|
281
|
+
* import fs from 'node:fs';
|
|
282
282
|
*
|
|
283
283
|
* const options = {
|
|
284
284
|
* pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
|
|
@@ -318,7 +318,7 @@ declare module "https" {
|
|
|
318
318
|
* upload a file with a POST request, then write to the `ClientRequest` object.
|
|
319
319
|
*
|
|
320
320
|
* ```js
|
|
321
|
-
*
|
|
321
|
+
* import https from 'node:https';
|
|
322
322
|
*
|
|
323
323
|
* const options = {
|
|
324
324
|
* hostname: 'encrypted.google.com',
|
|
@@ -391,9 +391,9 @@ declare module "https" {
|
|
|
391
391
|
* Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
|
|
392
392
|
*
|
|
393
393
|
* ```js
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
394
|
+
* import tls from 'node:tls';
|
|
395
|
+
* import https from 'node:https';
|
|
396
|
+
* import crypto from 'node:crypto';
|
|
397
397
|
*
|
|
398
398
|
* function sha256(s) {
|
|
399
399
|
* return crypto.createHash('sha256').update(s).digest('base64');
|
|
@@ -501,7 +501,7 @@ declare module "https" {
|
|
|
501
501
|
* string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
|
|
502
502
|
*
|
|
503
503
|
* ```js
|
|
504
|
-
*
|
|
504
|
+
* import https from 'node:https';
|
|
505
505
|
*
|
|
506
506
|
* https.get('https://encrypted.google.com/', (res) => {
|
|
507
507
|
* console.log('statusCode:', res.statusCode);
|
node v16.18/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* IN THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
// NOTE: These definitions support NodeJS and TypeScript
|
|
25
|
+
// NOTE: These definitions support NodeJS and TypeScript 5.7+.
|
|
26
26
|
|
|
27
27
|
// Reference required types from the default lib:
|
|
28
28
|
/// <reference lib="es2020" />
|
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
/// <reference lib="esnext.intl" />
|
|
31
31
|
/// <reference lib="esnext.bigint" />
|
|
32
32
|
|
|
33
|
+
// Definitions specific to TypeScript 5.7+
|
|
34
|
+
/// <reference path="globals.typedarray.d.ts" />
|
|
35
|
+
/// <reference path="buffer.buffer.d.ts" />
|
|
36
|
+
|
|
33
37
|
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
|
34
38
|
/// <reference path="assert.d.ts" />
|
|
35
39
|
/// <reference path="assert/strict.d.ts" />
|
node v16.18/inspector.d.ts
CHANGED
node v16.18/module.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ declare module "module" {
|
|
|
11
11
|
* does not add or remove exported names from the `ES Modules`.
|
|
12
12
|
*
|
|
13
13
|
* ```js
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* import fs from 'node:fs';
|
|
15
|
+
* import assert from 'node:assert';
|
|
16
|
+
* import { syncBuiltinESMExports } from 'node:module';
|
|
17
17
|
*
|
|
18
18
|
* fs.readFile = newAPI;
|
|
19
19
|
*
|
node v16.18/net.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* It can be accessed using:
|
|
9
9
|
*
|
|
10
10
|
* ```js
|
|
11
|
-
*
|
|
11
|
+
* import net from 'node:net';
|
|
12
12
|
* ```
|
|
13
13
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/net.js)
|
|
14
14
|
*/
|
|
@@ -717,7 +717,7 @@ declare module "net" {
|
|
|
717
717
|
* on port 8124:
|
|
718
718
|
*
|
|
719
719
|
* ```js
|
|
720
|
-
*
|
|
720
|
+
* import net from 'node:net';
|
|
721
721
|
* const server = net.createServer((c) => {
|
|
722
722
|
* // 'connection' listener.
|
|
723
723
|
* console.log('client connected');
|