@types/node 18.16.3 → 20.0.0
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 +68 -73
- node/async_hooks.d.ts +62 -42
- node/buffer.d.ts +123 -95
- node/child_process.d.ts +50 -54
- node/cluster.d.ts +12 -12
- node/console.d.ts +5 -5
- node/crypto.d.ts +209 -220
- node/dgram.d.ts +15 -15
- node/diagnostics_channel.d.ts +25 -26
- node/dns/promises.d.ts +6 -6
- node/dns.d.ts +16 -16
- node/domain.d.ts +3 -3
- node/events.d.ts +60 -60
- node/fs/promises.d.ts +74 -48
- node/fs.d.ts +91 -81
- node/http.d.ts +147 -144
- node/http2.d.ts +42 -46
- node/https.d.ts +52 -153
- node/index.d.ts +1 -1
- node/inspector.d.ts +10 -3
- node/module.d.ts +5 -4
- node/net.d.ts +21 -18
- node/os.d.ts +22 -18
- node/package.json +2 -2
- node/path.d.ts +4 -4
- node/perf_hooks.d.ts +28 -15
- node/process.d.ts +43 -46
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +5 -5
- node/readline/promises.d.ts +6 -4
- node/readline.d.ts +15 -15
- node/repl.d.ts +9 -9
- node/stream/consumers.d.ts +1 -1
- node/stream.d.ts +74 -136
- node/string_decoder.d.ts +6 -6
- node/test.d.ts +0 -76
- node/timers/promises.d.ts +3 -3
- node/timers.d.ts +2 -2
- node/tls.d.ts +22 -15
- node/trace_events.d.ts +20 -9
- node/ts4.8/assert.d.ts +68 -73
- node/ts4.8/async_hooks.d.ts +59 -31
- node/ts4.8/buffer.d.ts +123 -95
- node/ts4.8/child_process.d.ts +50 -54
- node/ts4.8/cluster.d.ts +12 -12
- node/ts4.8/console.d.ts +5 -5
- node/ts4.8/crypto.d.ts +209 -220
- node/ts4.8/dgram.d.ts +15 -15
- node/ts4.8/diagnostics_channel.d.ts +25 -26
- node/ts4.8/dns/promises.d.ts +6 -6
- node/ts4.8/dns.d.ts +16 -16
- node/ts4.8/domain.d.ts +3 -3
- node/ts4.8/events.d.ts +60 -60
- node/ts4.8/fs/promises.d.ts +72 -45
- node/ts4.8/fs.d.ts +81 -67
- node/ts4.8/http.d.ts +133 -126
- node/ts4.8/http2.d.ts +42 -46
- node/ts4.8/https.d.ts +52 -153
- node/ts4.8/inspector.d.ts +10 -3
- node/ts4.8/module.d.ts +5 -4
- node/ts4.8/net.d.ts +21 -18
- node/ts4.8/os.d.ts +22 -18
- node/ts4.8/path.d.ts +4 -4
- node/ts4.8/perf_hooks.d.ts +28 -15
- node/ts4.8/process.d.ts +43 -46
- node/ts4.8/punycode.d.ts +1 -1
- node/ts4.8/querystring.d.ts +5 -5
- node/ts4.8/readline/promises.d.ts +6 -4
- node/ts4.8/readline.d.ts +15 -15
- node/ts4.8/repl.d.ts +9 -9
- node/ts4.8/stream/consumers.d.ts +1 -1
- node/ts4.8/stream.d.ts +77 -139
- node/ts4.8/string_decoder.d.ts +6 -6
- node/ts4.8/test.d.ts +0 -75
- node/ts4.8/timers/promises.d.ts +3 -3
- node/ts4.8/timers.d.ts +2 -2
- node/ts4.8/tls.d.ts +22 -15
- node/ts4.8/trace_events.d.ts +20 -9
- node/ts4.8/tty.d.ts +4 -5
- node/ts4.8/url.d.ts +26 -36
- node/ts4.8/util.d.ts +143 -116
- node/ts4.8/v8.d.ts +107 -16
- node/ts4.8/vm.d.ts +292 -42
- node/ts4.8/wasi.d.ts +8 -14
- node/ts4.8/worker_threads.d.ts +32 -34
- node/ts4.8/zlib.d.ts +11 -11
- node/tty.d.ts +4 -5
- node/url.d.ts +26 -36
- node/util.d.ts +146 -111
- node/v8.d.ts +110 -16
- node/vm.d.ts +292 -42
- node/wasi.d.ts +8 -14
- node/worker_threads.d.ts +32 -34
- node/zlib.d.ts +11 -11
node/http2.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol.
|
|
3
|
-
* can be accessed using:
|
|
2
|
+
* The `node:http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol.
|
|
3
|
+
* It can be accessed using:
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
|
-
* const http2 = require('http2');
|
|
6
|
+
* const http2 = require('node:http2');
|
|
7
7
|
* ```
|
|
8
8
|
* @since v8.4.0
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/http2.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'http2' {
|
|
12
12
|
import EventEmitter = require('node:events');
|
|
@@ -151,7 +151,7 @@ declare module 'http2' {
|
|
|
151
151
|
priority(options: StreamPriorityOptions): void;
|
|
152
152
|
/**
|
|
153
153
|
* ```js
|
|
154
|
-
* const http2 = require('http2');
|
|
154
|
+
* const http2 = require('node:http2');
|
|
155
155
|
* const client = http2.connect('http://example.org:8000');
|
|
156
156
|
* const { NGHTTP2_CANCEL } = http2.constants;
|
|
157
157
|
* const req = client.request({ ':path': '/' });
|
|
@@ -171,7 +171,7 @@ declare module 'http2' {
|
|
|
171
171
|
* trailers can be sent.
|
|
172
172
|
*
|
|
173
173
|
* ```js
|
|
174
|
-
* const http2 = require('http2');
|
|
174
|
+
* const http2 = require('node:http2');
|
|
175
175
|
* const server = http2.createServer();
|
|
176
176
|
* server.on('stream', (stream) => {
|
|
177
177
|
* stream.respond(undefined, { waitForTrailers: true });
|
|
@@ -332,7 +332,7 @@ declare module 'http2' {
|
|
|
332
332
|
* 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.
|
|
333
333
|
*
|
|
334
334
|
* ```js
|
|
335
|
-
* const http2 = require('http2');
|
|
335
|
+
* const http2 = require('node:http2');
|
|
336
336
|
* const server = http2.createServer();
|
|
337
337
|
* server.on('stream', (stream) => {
|
|
338
338
|
* stream.respond({ ':status': 200 });
|
|
@@ -357,7 +357,7 @@ declare module 'http2' {
|
|
|
357
357
|
pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void;
|
|
358
358
|
/**
|
|
359
359
|
* ```js
|
|
360
|
-
* const http2 = require('http2');
|
|
360
|
+
* const http2 = require('node:http2');
|
|
361
361
|
* const server = http2.createServer();
|
|
362
362
|
* server.on('stream', (stream) => {
|
|
363
363
|
* stream.respond({ ':status': 200 });
|
|
@@ -365,16 +365,15 @@ declare module 'http2' {
|
|
|
365
365
|
* });
|
|
366
366
|
* ```
|
|
367
367
|
*
|
|
368
|
-
* When the `options.waitForTrailers` option is set, the
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
* header fields to the peer.
|
|
368
|
+
* Initiates a response. When the `options.waitForTrailers` option is set, the`'wantTrailers'` event will be emitted immediately after queuing the last chunk
|
|
369
|
+
* of payload data to be sent. The `http2stream.sendTrailers()` method can then be
|
|
370
|
+
* used to sent trailing header fields to the peer.
|
|
372
371
|
*
|
|
373
372
|
* When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
|
|
374
373
|
* close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
|
|
375
374
|
*
|
|
376
375
|
* ```js
|
|
377
|
-
* const http2 = require('http2');
|
|
376
|
+
* const http2 = require('node:http2');
|
|
378
377
|
* const server = http2.createServer();
|
|
379
378
|
* server.on('stream', (stream) => {
|
|
380
379
|
* stream.respond({ ':status': 200 }, { waitForTrailers: true });
|
|
@@ -397,8 +396,8 @@ declare module 'http2' {
|
|
|
397
396
|
* automatically.
|
|
398
397
|
*
|
|
399
398
|
* ```js
|
|
400
|
-
* const http2 = require('http2');
|
|
401
|
-
* const fs = require('fs');
|
|
399
|
+
* const http2 = require('node:http2');
|
|
400
|
+
* const fs = require('node:fs');
|
|
402
401
|
*
|
|
403
402
|
* const server = http2.createServer();
|
|
404
403
|
* server.on('stream', (stream) => {
|
|
@@ -408,7 +407,7 @@ declare module 'http2' {
|
|
|
408
407
|
* const headers = {
|
|
409
408
|
* 'content-length': stat.size,
|
|
410
409
|
* 'last-modified': stat.mtime.toUTCString(),
|
|
411
|
-
* 'content-type': 'text/plain; charset=utf-8'
|
|
410
|
+
* 'content-type': 'text/plain; charset=utf-8',
|
|
412
411
|
* };
|
|
413
412
|
* stream.respondWithFD(fd, headers);
|
|
414
413
|
* stream.on('close', () => fs.closeSync(fd));
|
|
@@ -439,8 +438,8 @@ declare module 'http2' {
|
|
|
439
438
|
* close when the final `DATA` frame is transmitted. User code _must_ call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
|
|
440
439
|
*
|
|
441
440
|
* ```js
|
|
442
|
-
* const http2 = require('http2');
|
|
443
|
-
* const fs = require('fs');
|
|
441
|
+
* const http2 = require('node:http2');
|
|
442
|
+
* const fs = require('node:fs');
|
|
444
443
|
*
|
|
445
444
|
* const server = http2.createServer();
|
|
446
445
|
* server.on('stream', (stream) => {
|
|
@@ -450,7 +449,7 @@ declare module 'http2' {
|
|
|
450
449
|
* const headers = {
|
|
451
450
|
* 'content-length': stat.size,
|
|
452
451
|
* 'last-modified': stat.mtime.toUTCString(),
|
|
453
|
-
* 'content-type': 'text/plain; charset=utf-8'
|
|
452
|
+
* 'content-type': 'text/plain; charset=utf-8',
|
|
454
453
|
* };
|
|
455
454
|
* stream.respondWithFD(fd, headers, { waitForTrailers: true });
|
|
456
455
|
* stream.on('wantTrailers', () => {
|
|
@@ -482,7 +481,7 @@ declare module 'http2' {
|
|
|
482
481
|
* Example using a file path:
|
|
483
482
|
*
|
|
484
483
|
* ```js
|
|
485
|
-
* const http2 = require('http2');
|
|
484
|
+
* const http2 = require('node:http2');
|
|
486
485
|
* const server = http2.createServer();
|
|
487
486
|
* server.on('stream', (stream) => {
|
|
488
487
|
* function statCheck(stat, headers) {
|
|
@@ -500,7 +499,7 @@ declare module 'http2' {
|
|
|
500
499
|
* }
|
|
501
500
|
* } catch (err) {
|
|
502
501
|
* // Perform actual error handling.
|
|
503
|
-
* console.
|
|
502
|
+
* console.error(err);
|
|
504
503
|
* }
|
|
505
504
|
* stream.end();
|
|
506
505
|
* }
|
|
@@ -516,7 +515,7 @@ declare module 'http2' {
|
|
|
516
515
|
* results to determine if the file has been modified to return an appropriate`304` response:
|
|
517
516
|
*
|
|
518
517
|
* ```js
|
|
519
|
-
* const http2 = require('http2');
|
|
518
|
+
* const http2 = require('node:http2');
|
|
520
519
|
* const server = http2.createServer();
|
|
521
520
|
* server.on('stream', (stream) => {
|
|
522
521
|
* function statCheck(stat, headers) {
|
|
@@ -549,7 +548,7 @@ declare module 'http2' {
|
|
|
549
548
|
* close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
|
|
550
549
|
*
|
|
551
550
|
* ```js
|
|
552
|
-
* const http2 = require('http2');
|
|
551
|
+
* const http2 = require('node:http2');
|
|
553
552
|
* const server = http2.createServer();
|
|
554
553
|
* server.on('stream', (stream) => {
|
|
555
554
|
* stream.respondWithFile('/some/file',
|
|
@@ -748,7 +747,7 @@ declare module 'http2' {
|
|
|
748
747
|
* the delta.
|
|
749
748
|
*
|
|
750
749
|
* ```js
|
|
751
|
-
* const http2 = require('http2');
|
|
750
|
+
* const http2 = require('node:http2');
|
|
752
751
|
*
|
|
753
752
|
* const server = http2.createServer();
|
|
754
753
|
* const expectedWindowSize = 2 ** 20;
|
|
@@ -854,11 +853,11 @@ declare module 'http2' {
|
|
|
854
853
|
* This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`.
|
|
855
854
|
*
|
|
856
855
|
* ```js
|
|
857
|
-
* const http2 = require('http2');
|
|
856
|
+
* const http2 = require('node:http2');
|
|
858
857
|
* const clientSession = http2.connect('https://localhost:1234');
|
|
859
858
|
* const {
|
|
860
859
|
* HTTP2_HEADER_PATH,
|
|
861
|
-
* HTTP2_HEADER_STATUS
|
|
860
|
+
* HTTP2_HEADER_STATUS,
|
|
862
861
|
* } = http2.constants;
|
|
863
862
|
*
|
|
864
863
|
* const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' });
|
|
@@ -928,7 +927,7 @@ declare module 'http2' {
|
|
|
928
927
|
* Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
|
|
929
928
|
*
|
|
930
929
|
* ```js
|
|
931
|
-
* const http2 = require('http2');
|
|
930
|
+
* const http2 = require('node:http2');
|
|
932
931
|
*
|
|
933
932
|
* const server = http2.createServer();
|
|
934
933
|
* server.on('session', (session) => {
|
|
@@ -969,7 +968,7 @@ declare module 'http2' {
|
|
|
969
968
|
* authoritative responses.
|
|
970
969
|
*
|
|
971
970
|
* ```js
|
|
972
|
-
* const http2 = require('http2');
|
|
971
|
+
* const http2 = require('node:http2');
|
|
973
972
|
* const options = getSecureOptionsSomehow();
|
|
974
973
|
* const server = http2.createSecureServer(options);
|
|
975
974
|
* server.on('stream', (stream) => {
|
|
@@ -995,7 +994,7 @@ declare module 'http2' {
|
|
|
995
994
|
* server using the `http2.createSecureServer()` method:
|
|
996
995
|
*
|
|
997
996
|
* ```js
|
|
998
|
-
* const http2 = require('http2');
|
|
997
|
+
* const http2 = require('node:http2');
|
|
999
998
|
* const options = getSecureOptionsSomehow();
|
|
1000
999
|
* options.origins = ['https://example.com', 'https://example.org'];
|
|
1001
1000
|
* const server = http2.createSecureServer(options);
|
|
@@ -1436,7 +1435,7 @@ declare module 'http2' {
|
|
|
1436
1435
|
*/
|
|
1437
1436
|
readonly headersSent: boolean;
|
|
1438
1437
|
/**
|
|
1439
|
-
* A reference to the original HTTP2 request object.
|
|
1438
|
+
* A reference to the original HTTP2 `request` object.
|
|
1440
1439
|
* @since v15.7.0
|
|
1441
1440
|
*/
|
|
1442
1441
|
readonly req: Http2ServerRequest;
|
|
@@ -1457,7 +1456,7 @@ declare module 'http2' {
|
|
|
1457
1456
|
* All other interactions will be routed directly to the socket.
|
|
1458
1457
|
*
|
|
1459
1458
|
* ```js
|
|
1460
|
-
* const http2 = require('http2');
|
|
1459
|
+
* const http2 = require('node:http2');
|
|
1461
1460
|
* const server = http2.createServer((req, res) => {
|
|
1462
1461
|
* const ip = req.socket.remoteAddress;
|
|
1463
1462
|
* const port = req.socket.remotePort;
|
|
@@ -1640,7 +1639,7 @@ declare module 'http2' {
|
|
|
1640
1639
|
* This sends a chunk of the response body. This method may
|
|
1641
1640
|
* be called multiple times to provide successive parts of the body.
|
|
1642
1641
|
*
|
|
1643
|
-
* In the `http` module, the response body is omitted when the
|
|
1642
|
+
* In the `node:http` module, the response body is omitted when the
|
|
1644
1643
|
* request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body.
|
|
1645
1644
|
*
|
|
1646
1645
|
* `chunk` can be a string or a buffer. If `chunk` is a string,
|
|
@@ -1675,7 +1674,7 @@ declare module 'http2' {
|
|
|
1675
1674
|
* The `hints` is an object containing the values of headers to be sent with
|
|
1676
1675
|
* early hints message.
|
|
1677
1676
|
*
|
|
1678
|
-
* Example
|
|
1677
|
+
* **Example**
|
|
1679
1678
|
*
|
|
1680
1679
|
* ```js
|
|
1681
1680
|
* const earlyHintsLink = '</styles.css>; rel=preload; as=style';
|
|
@@ -1689,12 +1688,9 @@ declare module 'http2' {
|
|
|
1689
1688
|
* ];
|
|
1690
1689
|
* response.writeEarlyHints({
|
|
1691
1690
|
* 'link': earlyHintsLinks,
|
|
1692
|
-
* 'x-trace-id': 'id for diagnostics'
|
|
1693
1691
|
* });
|
|
1694
1692
|
* ```
|
|
1695
|
-
*
|
|
1696
1693
|
* @since v18.11.0
|
|
1697
|
-
* @param hints An object containing the values of headers
|
|
1698
1694
|
*/
|
|
1699
1695
|
writeEarlyHints(hints: Record<string, string | string[]>): void;
|
|
1700
1696
|
/**
|
|
@@ -2027,7 +2023,7 @@ declare module 'http2' {
|
|
|
2027
2023
|
* for use with the `HTTP2-Settings` header field.
|
|
2028
2024
|
*
|
|
2029
2025
|
* ```js
|
|
2030
|
-
* const http2 = require('http2');
|
|
2026
|
+
* const http2 = require('node:http2');
|
|
2031
2027
|
*
|
|
2032
2028
|
* const packed = http2.getPackedSettings({ enablePush: false });
|
|
2033
2029
|
*
|
|
@@ -2052,7 +2048,7 @@ declare module 'http2' {
|
|
|
2052
2048
|
* with browser clients.
|
|
2053
2049
|
*
|
|
2054
2050
|
* ```js
|
|
2055
|
-
* const http2 = require('http2');
|
|
2051
|
+
* const http2 = require('node:http2');
|
|
2056
2052
|
*
|
|
2057
2053
|
* // Create an unencrypted HTTP/2 server.
|
|
2058
2054
|
* // Since there are no browsers known that support
|
|
@@ -2063,12 +2059,12 @@ declare module 'http2' {
|
|
|
2063
2059
|
* server.on('stream', (stream, headers) => {
|
|
2064
2060
|
* stream.respond({
|
|
2065
2061
|
* 'content-type': 'text/html; charset=utf-8',
|
|
2066
|
-
* ':status': 200
|
|
2062
|
+
* ':status': 200,
|
|
2067
2063
|
* });
|
|
2068
2064
|
* stream.end('<h1>Hello World</h1>');
|
|
2069
2065
|
* });
|
|
2070
2066
|
*
|
|
2071
|
-
* server.listen(
|
|
2067
|
+
* server.listen(8000);
|
|
2072
2068
|
* ```
|
|
2073
2069
|
* @since v8.4.0
|
|
2074
2070
|
* @param onRequestHandler See `Compatibility API`
|
|
@@ -2079,12 +2075,12 @@ declare module 'http2' {
|
|
|
2079
2075
|
* Returns a `tls.Server` instance that creates and manages `Http2Session`instances.
|
|
2080
2076
|
*
|
|
2081
2077
|
* ```js
|
|
2082
|
-
* const http2 = require('http2');
|
|
2083
|
-
* const fs = require('fs');
|
|
2078
|
+
* const http2 = require('node:http2');
|
|
2079
|
+
* const fs = require('node:fs');
|
|
2084
2080
|
*
|
|
2085
2081
|
* const options = {
|
|
2086
2082
|
* key: fs.readFileSync('server-key.pem'),
|
|
2087
|
-
* cert: fs.readFileSync('server-cert.pem')
|
|
2083
|
+
* cert: fs.readFileSync('server-cert.pem'),
|
|
2088
2084
|
* };
|
|
2089
2085
|
*
|
|
2090
2086
|
* // Create a secure HTTP/2 server
|
|
@@ -2093,12 +2089,12 @@ declare module 'http2' {
|
|
|
2093
2089
|
* server.on('stream', (stream, headers) => {
|
|
2094
2090
|
* stream.respond({
|
|
2095
2091
|
* 'content-type': 'text/html; charset=utf-8',
|
|
2096
|
-
* ':status': 200
|
|
2092
|
+
* ':status': 200,
|
|
2097
2093
|
* });
|
|
2098
2094
|
* stream.end('<h1>Hello World</h1>');
|
|
2099
2095
|
* });
|
|
2100
2096
|
*
|
|
2101
|
-
* server.listen(
|
|
2097
|
+
* server.listen(8443);
|
|
2102
2098
|
* ```
|
|
2103
2099
|
* @since v8.4.0
|
|
2104
2100
|
* @param onRequestHandler See `Compatibility API`
|
|
@@ -2109,7 +2105,7 @@ declare module 'http2' {
|
|
|
2109
2105
|
* Returns a `ClientHttp2Session` instance.
|
|
2110
2106
|
*
|
|
2111
2107
|
* ```js
|
|
2112
|
-
* const http2 = require('http2');
|
|
2108
|
+
* const http2 = require('node:http2');
|
|
2113
2109
|
* const client = http2.connect('https://localhost:1234');
|
|
2114
2110
|
*
|
|
2115
2111
|
* // Use the client
|