@types/node 18.16.5 → 20.1.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 v18.16/README.md → node/README.md +2 -2
- node v18.16/ts4.8/assert.d.ts → node/assert.d.ts +71 -75
- node v18.16/async_hooks.d.ts → node/async_hooks.d.ts +62 -42
- node v18.16/buffer.d.ts → node/buffer.d.ts +127 -99
- node v18.16/child_process.d.ts → node/child_process.d.ts +50 -54
- node v18.16/ts4.8/cluster.d.ts → node/cluster.d.ts +12 -12
- node v18.16/ts4.8/console.d.ts → node/console.d.ts +5 -5
- node v18.16/crypto.d.ts → node/crypto.d.ts +209 -220
- node v18.16/ts4.8/dgram.d.ts → node/dgram.d.ts +15 -15
- node v18.16/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +25 -26
- node v18.16/dns/promises.d.ts → node/dns/promises.d.ts +6 -6
- node v18.16/ts4.8/dns.d.ts → node/dns.d.ts +24 -16
- node v18.16/domain.d.ts → node/domain.d.ts +4 -4
- node v18.16/events.d.ts → node/events.d.ts +60 -60
- node v18.16/fs/promises.d.ts → node/fs/promises.d.ts +78 -48
- node v18.16/fs.d.ts → node/fs.d.ts +117 -81
- node v18.16/http.d.ts → node/http.d.ts +155 -145
- node v18.16/ts4.8/http2.d.ts → node/http2.d.ts +42 -46
- node v18.16/https.d.ts → node/https.d.ts +52 -153
- node v18.16/index.d.ts → node/index.d.ts +1 -1
- node v18.16/ts4.8/inspector.d.ts → node/inspector.d.ts +10 -3
- node v18.16/ts4.8/module.d.ts → node/module.d.ts +5 -4
- node v18.16/ts4.8/net.d.ts → node/net.d.ts +24 -21
- node v18.16/ts4.8/os.d.ts → node/os.d.ts +22 -18
- node v18.16/package.json → node/package.json +2 -2
- node v18.16/ts4.8/path.d.ts → node/path.d.ts +4 -4
- node v18.16/perf_hooks.d.ts → node/perf_hooks.d.ts +28 -15
- node v18.16/process.d.ts → node/process.d.ts +43 -46
- node v18.16/ts4.8/punycode.d.ts → node/punycode.d.ts +1 -1
- node v18.16/ts4.8/querystring.d.ts → node/querystring.d.ts +5 -5
- node v18.16/readline/promises.d.ts → node/readline/promises.d.ts +6 -4
- node v18.16/readline.d.ts → node/readline.d.ts +15 -15
- node v18.16/repl.d.ts → node/repl.d.ts +9 -9
- node v18.16/stream/consumers.d.ts → node/stream/consumers.d.ts +1 -1
- node v18.16/stream.d.ts → node/stream.d.ts +88 -136
- node v18.16/ts4.8/string_decoder.d.ts → node/string_decoder.d.ts +6 -6
- node v18.16/ts4.8/test.d.ts → node/test.d.ts +423 -186
- node v18.16/timers/promises.d.ts → node/timers/promises.d.ts +3 -3
- node v18.16/timers.d.ts → node/timers.d.ts +2 -2
- node v18.16/ts4.8/tls.d.ts → node/tls.d.ts +24 -16
- node v18.16/ts4.8/trace_events.d.ts → node/trace_events.d.ts +20 -9
- node v18.16/assert.d.ts → node/ts4.8/assert.d.ts +71 -75
- node v18.16/ts4.8/async_hooks.d.ts → node/ts4.8/async_hooks.d.ts +62 -42
- node v18.16/ts4.8/buffer.d.ts → node/ts4.8/buffer.d.ts +127 -99
- node v18.16/ts4.8/child_process.d.ts → node/ts4.8/child_process.d.ts +50 -54
- node v18.16/cluster.d.ts → node/ts4.8/cluster.d.ts +12 -12
- node v18.16/console.d.ts → node/ts4.8/console.d.ts +5 -5
- node v18.16/ts4.8/crypto.d.ts → node/ts4.8/crypto.d.ts +209 -220
- node v18.16/dgram.d.ts → node/ts4.8/dgram.d.ts +15 -15
- node v18.16/ts4.8/diagnostics_channel.d.ts → node/ts4.8/diagnostics_channel.d.ts +25 -26
- node v18.16/ts4.8/dns/promises.d.ts → node/ts4.8/dns/promises.d.ts +6 -6
- node v18.16/dns.d.ts → node/ts4.8/dns.d.ts +24 -16
- node v18.16/ts4.8/domain.d.ts → node/ts4.8/domain.d.ts +4 -4
- node v18.16/ts4.8/events.d.ts → node/ts4.8/events.d.ts +60 -60
- node v18.16/ts4.8/fs/promises.d.ts → node/ts4.8/fs/promises.d.ts +96 -45
- node v18.16/ts4.8/fs.d.ts → node/ts4.8/fs.d.ts +203 -67
- node v18.16/ts4.8/globals.d.ts → node/ts4.8/globals.d.ts +29 -28
- node v18.16/ts4.8/http.d.ts → node/ts4.8/http.d.ts +198 -126
- node v18.16/http2.d.ts → node/ts4.8/http2.d.ts +42 -46
- node v18.16/ts4.8/https.d.ts → node/ts4.8/https.d.ts +52 -153
- node v18.16/inspector.d.ts → node/ts4.8/inspector.d.ts +10 -3
- node v18.16/module.d.ts → node/ts4.8/module.d.ts +5 -4
- node v18.16/net.d.ts → node/ts4.8/net.d.ts +21 -18
- node v18.16/os.d.ts → node/ts4.8/os.d.ts +22 -18
- node v18.16/path.d.ts → node/ts4.8/path.d.ts +4 -4
- node v18.16/ts4.8/perf_hooks.d.ts → node/ts4.8/perf_hooks.d.ts +28 -15
- node v18.16/ts4.8/process.d.ts → node/ts4.8/process.d.ts +43 -46
- node v18.16/punycode.d.ts → node/ts4.8/punycode.d.ts +1 -1
- node v18.16/querystring.d.ts → node/ts4.8/querystring.d.ts +5 -5
- node v18.16/ts4.8/readline/promises.d.ts → node/ts4.8/readline/promises.d.ts +6 -4
- node v18.16/ts4.8/readline.d.ts → node/ts4.8/readline.d.ts +15 -15
- node v18.16/ts4.8/repl.d.ts → node/ts4.8/repl.d.ts +9 -9
- node v18.16/ts4.8/stream/consumers.d.ts → node/ts4.8/stream/consumers.d.ts +1 -1
- node v18.16/ts4.8/stream.d.ts → node/ts4.8/stream.d.ts +91 -139
- node v18.16/string_decoder.d.ts → node/ts4.8/string_decoder.d.ts +6 -6
- node v18.16/test.d.ts → node/ts4.8/test.d.ts +423 -186
- node v18.16/ts4.8/timers/promises.d.ts → node/ts4.8/timers/promises.d.ts +3 -3
- node v18.16/ts4.8/timers.d.ts → node/ts4.8/timers.d.ts +9 -2
- node v18.16/tls.d.ts → node/ts4.8/tls.d.ts +24 -16
- node v18.16/trace_events.d.ts → node/ts4.8/trace_events.d.ts +20 -9
- node v18.16/tty.d.ts → node/ts4.8/tty.d.ts +4 -5
- node v18.16/ts4.8/url.d.ts → node/ts4.8/url.d.ts +26 -36
- node v18.16/ts4.8/util.d.ts → node/ts4.8/util.d.ts +143 -116
- node v18.16/ts4.8/v8.d.ts → node/ts4.8/v8.d.ts +110 -16
- node v18.16/vm.d.ts → node/ts4.8/vm.d.ts +292 -42
- node v18.16/wasi.d.ts → node/ts4.8/wasi.d.ts +13 -19
- node v18.16/ts4.8/worker_threads.d.ts → node/ts4.8/worker_threads.d.ts +32 -34
- node v18.16/zlib.d.ts → node/ts4.8/zlib.d.ts +11 -11
- node v18.16/ts4.8/tty.d.ts → node/tty.d.ts +4 -5
- node v18.16/url.d.ts → node/url.d.ts +26 -36
- node v18.16/util.d.ts → node/util.d.ts +146 -111
- node v18.16/v8.d.ts → node/v8.d.ts +110 -16
- node v18.16/ts4.8/vm.d.ts → node/vm.d.ts +292 -42
- node v18.16/ts4.8/wasi.d.ts → node/wasi.d.ts +13 -19
- node v18.16/worker_threads.d.ts → node/worker_threads.d.ts +32 -34
- node v18.16/ts4.8/zlib.d.ts → node/zlib.d.ts +11 -11
- {node v18.16 → node}/LICENSE +0 -0
- {node v18.16 → node}/assert/strict.d.ts +0 -0
- {node v18.16 → node}/constants.d.ts +0 -0
- {node v18.16 → node}/dom-events.d.ts +0 -0
- {node v18.16 → node}/globals.d.ts +0 -0
- {node v18.16 → node}/globals.global.d.ts +0 -0
- {node v18.16 → node}/stream/promises.d.ts +0 -0
- {node v18.16 → node}/stream/web.d.ts +0 -0
- {node v18.16 → node}/ts4.8/assert/strict.d.ts +0 -0
- {node v18.16 → node}/ts4.8/constants.d.ts +0 -0
- {node v18.16 → node}/ts4.8/dom-events.d.ts +0 -0
- {node v18.16 → node}/ts4.8/globals.global.d.ts +0 -0
- {node v18.16 → node}/ts4.8/index.d.ts +0 -0
- {node v18.16 → node}/ts4.8/stream/promises.d.ts +0 -0
- {node v18.16 → node}/ts4.8/stream/web.d.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `worker_threads` module enables the use of threads that execute
|
|
3
|
-
* in parallel. To access it:
|
|
2
|
+
* The `node:worker_threads` module enables the use of threads that execute
|
|
3
|
+
* JavaScript in parallel. To access it:
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
|
-
* const worker = require('worker_threads');
|
|
6
|
+
* const worker = require('node:worker_threads');
|
|
7
7
|
* ```
|
|
8
8
|
*
|
|
9
9
|
* Workers (threads) are useful for performing CPU-intensive JavaScript operations.
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
*
|
|
16
16
|
* ```js
|
|
17
17
|
* const {
|
|
18
|
-
* Worker, isMainThread, parentPort, workerData
|
|
19
|
-
* } = require('worker_threads');
|
|
18
|
+
* Worker, isMainThread, parentPort, workerData,
|
|
19
|
+
* } = require('node:worker_threads');
|
|
20
20
|
*
|
|
21
21
|
* if (isMainThread) {
|
|
22
22
|
* module.exports = function parseJSAsync(script) {
|
|
23
23
|
* return new Promise((resolve, reject) => {
|
|
24
24
|
* const worker = new Worker(__filename, {
|
|
25
|
-
* workerData: script
|
|
25
|
+
* workerData: script,
|
|
26
26
|
* });
|
|
27
27
|
* worker.on('message', resolve);
|
|
28
28
|
* worker.on('error', reject);
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
*
|
|
50
50
|
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
|
|
51
51
|
* specifically `argv` and `execArgv` options.
|
|
52
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
52
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.1.0/lib/worker_threads.js)
|
|
53
53
|
*/
|
|
54
54
|
declare module 'worker_threads' {
|
|
55
55
|
import { Blob } from 'node:buffer';
|
|
@@ -72,7 +72,7 @@ declare module 'worker_threads' {
|
|
|
72
72
|
* The `MessageChannel` has no methods of its own. `new MessageChannel()`yields an object with `port1` and `port2` properties, which refer to linked `MessagePort` instances.
|
|
73
73
|
*
|
|
74
74
|
* ```js
|
|
75
|
-
* const { MessageChannel } = require('worker_threads');
|
|
75
|
+
* const { MessageChannel } = require('node:worker_threads');
|
|
76
76
|
*
|
|
77
77
|
* const { port1, port2 } = new MessageChannel();
|
|
78
78
|
* port1.on('message', (message) => console.log('received', message));
|
|
@@ -121,7 +121,7 @@ declare module 'worker_threads' {
|
|
|
121
121
|
* * `value` may not contain native (C++-backed) objects other than:
|
|
122
122
|
*
|
|
123
123
|
* ```js
|
|
124
|
-
* const { MessageChannel } = require('worker_threads');
|
|
124
|
+
* const { MessageChannel } = require('node:worker_threads');
|
|
125
125
|
* const { port1, port2 } = new MessageChannel();
|
|
126
126
|
*
|
|
127
127
|
* port1.on('message', (message) => console.log(message));
|
|
@@ -132,7 +132,7 @@ declare module 'worker_threads' {
|
|
|
132
132
|
* port2.postMessage(circularData);
|
|
133
133
|
* ```
|
|
134
134
|
*
|
|
135
|
-
* `transferList` may be a list of [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), `MessagePort
|
|
135
|
+
* `transferList` may be a list of [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), `MessagePort`, and `FileHandle` objects.
|
|
136
136
|
* After transferring, they are not usable on the sending side of the channel
|
|
137
137
|
* anymore (even if they are not contained in `value`). Unlike with `child processes`, transferring handles such as network sockets is currently
|
|
138
138
|
* not supported.
|
|
@@ -143,7 +143,7 @@ declare module 'worker_threads' {
|
|
|
143
143
|
* `value` may still contain `ArrayBuffer` instances that are not in`transferList`; in that case, the underlying memory is copied rather than moved.
|
|
144
144
|
*
|
|
145
145
|
* ```js
|
|
146
|
-
* const { MessageChannel } = require('worker_threads');
|
|
146
|
+
* const { MessageChannel } = require('node:worker_threads');
|
|
147
147
|
* const { port1, port2 } = new MessageChannel();
|
|
148
148
|
*
|
|
149
149
|
* port1.on('message', (message) => console.log(message));
|
|
@@ -170,7 +170,7 @@ declare module 'worker_threads' {
|
|
|
170
170
|
* posting without having side effects.
|
|
171
171
|
*
|
|
172
172
|
* For more information on the serialization and deserialization mechanisms
|
|
173
|
-
* behind this API, see the `serialization API of the v8 module`.
|
|
173
|
+
* behind this API, see the `serialization API of the node:v8 module`.
|
|
174
174
|
* @since v10.5.0
|
|
175
175
|
*/
|
|
176
176
|
postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
|
|
@@ -294,9 +294,9 @@ declare module 'worker_threads' {
|
|
|
294
294
|
*
|
|
295
295
|
* Notable differences inside a Worker environment are:
|
|
296
296
|
*
|
|
297
|
-
* * The `process.stdin`, `process.stdout
|
|
298
|
-
* * The `require('worker_threads').isMainThread` property is set to `false`.
|
|
299
|
-
* * The `require('worker_threads').parentPort` message port is available.
|
|
297
|
+
* * The `process.stdin`, `process.stdout`, and `process.stderr` streams may be redirected by the parent thread.
|
|
298
|
+
* * The `require('node:worker_threads').isMainThread` property is set to `false`.
|
|
299
|
+
* * The `require('node:worker_threads').parentPort` message port is available.
|
|
300
300
|
* * `process.exit()` does not stop the whole program, just the single thread,
|
|
301
301
|
* and `process.abort()` is not available.
|
|
302
302
|
* * `process.chdir()` and `process` methods that set group or user ids
|
|
@@ -313,11 +313,11 @@ declare module 'worker_threads' {
|
|
|
313
313
|
*
|
|
314
314
|
* Creating `Worker` instances inside of other `Worker`s is possible.
|
|
315
315
|
*
|
|
316
|
-
* Like [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) and the `cluster module`, two-way communication
|
|
317
|
-
* achieved through inter-thread message passing. Internally, a `Worker` has
|
|
318
|
-
* built-in pair of `MessagePort` s that are already associated with each
|
|
319
|
-
* when the `Worker` is created. While the `MessagePort` object on the parent
|
|
320
|
-
* is not directly exposed, its functionalities are exposed through `worker.postMessage()` and the `worker.on('message')` event
|
|
316
|
+
* Like [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) and the `node:cluster module`, two-way communication
|
|
317
|
+
* can be achieved through inter-thread message passing. Internally, a `Worker` has
|
|
318
|
+
* a built-in pair of `MessagePort` s that are already associated with each
|
|
319
|
+
* other when the `Worker` is created. While the `MessagePort` object on the parent
|
|
320
|
+
* side is not directly exposed, its functionalities are exposed through `worker.postMessage()` and the `worker.on('message')` event
|
|
321
321
|
* on the `Worker` object for the parent thread.
|
|
322
322
|
*
|
|
323
323
|
* To create custom messaging channels (which is encouraged over using the default
|
|
@@ -330,10 +330,10 @@ declare module 'worker_threads' {
|
|
|
330
330
|
* the thread barrier.
|
|
331
331
|
*
|
|
332
332
|
* ```js
|
|
333
|
-
* const assert = require('assert');
|
|
333
|
+
* const assert = require('node:assert');
|
|
334
334
|
* const {
|
|
335
|
-
* Worker, MessageChannel, MessagePort, isMainThread, parentPort
|
|
336
|
-
* } = require('worker_threads');
|
|
335
|
+
* Worker, MessageChannel, MessagePort, isMainThread, parentPort,
|
|
336
|
+
* } = require('node:worker_threads');
|
|
337
337
|
* if (isMainThread) {
|
|
338
338
|
* const worker = new Worker(__filename);
|
|
339
339
|
* const subChannel = new MessageChannel();
|
|
@@ -373,7 +373,7 @@ declare module 'worker_threads' {
|
|
|
373
373
|
readonly stderr: Readable;
|
|
374
374
|
/**
|
|
375
375
|
* An integer identifier for the referenced thread. Inside the worker thread,
|
|
376
|
-
* it is available as `require('worker_threads').threadId`.
|
|
376
|
+
* it is available as `require('node:worker_threads').threadId`.
|
|
377
377
|
* This value is unique for each `Worker` instance inside a single process.
|
|
378
378
|
* @since v10.5.0
|
|
379
379
|
*/
|
|
@@ -400,7 +400,7 @@ declare module 'worker_threads' {
|
|
|
400
400
|
*/
|
|
401
401
|
constructor(filename: string | URL, options?: WorkerOptions);
|
|
402
402
|
/**
|
|
403
|
-
* Send a message to the worker that is received via `require('worker_threads').parentPort.on('message')`.
|
|
403
|
+
* Send a message to the worker that is received via `require('node:worker_threads').parentPort.on('message')`.
|
|
404
404
|
* See `port.postMessage()` for more details.
|
|
405
405
|
* @since v10.5.0
|
|
406
406
|
*/
|
|
@@ -494,8 +494,8 @@ declare module 'worker_threads' {
|
|
|
494
494
|
* const {
|
|
495
495
|
* isMainThread,
|
|
496
496
|
* BroadcastChannel,
|
|
497
|
-
* Worker
|
|
498
|
-
* } = require('worker_threads');
|
|
497
|
+
* Worker,
|
|
498
|
+
* } = require('node:worker_threads');
|
|
499
499
|
*
|
|
500
500
|
* const bc = new BroadcastChannel('hello');
|
|
501
501
|
*
|
|
@@ -549,7 +549,7 @@ declare module 'worker_threads' {
|
|
|
549
549
|
* This operation cannot be undone.
|
|
550
550
|
*
|
|
551
551
|
* ```js
|
|
552
|
-
* const { MessageChannel, markAsUntransferable } = require('worker_threads');
|
|
552
|
+
* const { MessageChannel, markAsUntransferable } = require('node:worker_threads');
|
|
553
553
|
*
|
|
554
554
|
* const pooledBuffer = new ArrayBuffer(8);
|
|
555
555
|
* const typedArray1 = new Uint8Array(pooledBuffer);
|
|
@@ -591,10 +591,10 @@ declare module 'worker_threads' {
|
|
|
591
591
|
function moveMessagePortToContext(port: MessagePort, contextifiedSandbox: Context): MessagePort;
|
|
592
592
|
/**
|
|
593
593
|
* Receive a single message from a given `MessagePort`. If no message is available,`undefined` is returned, otherwise an object with a single `message` property
|
|
594
|
-
* that contains the message payload, corresponding to the oldest message in the`MessagePort
|
|
594
|
+
* that contains the message payload, corresponding to the oldest message in the`MessagePort`'s queue.
|
|
595
595
|
*
|
|
596
596
|
* ```js
|
|
597
|
-
* const { MessageChannel, receiveMessageOnPort } = require('worker_threads');
|
|
597
|
+
* const { MessageChannel, receiveMessageOnPort } = require('node:worker_threads');
|
|
598
598
|
* const { port1, port2 } = new MessageChannel();
|
|
599
599
|
* port1.postMessage({ hello: 'world' });
|
|
600
600
|
*
|
|
@@ -625,7 +625,7 @@ declare module 'worker_threads' {
|
|
|
625
625
|
* isMainThread,
|
|
626
626
|
* setEnvironmentData,
|
|
627
627
|
* getEnvironmentData,
|
|
628
|
-
* } = require('worker_threads');
|
|
628
|
+
* } = require('node:worker_threads');
|
|
629
629
|
*
|
|
630
630
|
* if (isMainThread) {
|
|
631
631
|
* setEnvironmentData('Hello', 'World!');
|
|
@@ -664,7 +664,6 @@ declare module 'worker_threads' {
|
|
|
664
664
|
}
|
|
665
665
|
? T
|
|
666
666
|
: typeof _BroadcastChannel;
|
|
667
|
-
|
|
668
667
|
/**
|
|
669
668
|
* `MessageChannel` class is a global reference for `require('worker_threads').MessageChannel`
|
|
670
669
|
* https://nodejs.org/api/globals.html#messagechannel
|
|
@@ -676,13 +675,12 @@ declare module 'worker_threads' {
|
|
|
676
675
|
}
|
|
677
676
|
? T
|
|
678
677
|
: typeof _MessageChannel;
|
|
679
|
-
|
|
680
678
|
/**
|
|
681
679
|
* `MessagePort` class is a global reference for `require('worker_threads').MessagePort`
|
|
682
680
|
* https://nodejs.org/api/globals.html#messageport
|
|
683
681
|
* @since v15.0.0
|
|
684
682
|
*/
|
|
685
|
-
|
|
683
|
+
var MessagePort: typeof globalThis extends {
|
|
686
684
|
onmessage: any;
|
|
687
685
|
MessagePort: infer T;
|
|
688
686
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `zlib` module provides compression functionality implemented using
|
|
3
|
-
* Deflate/Inflate, and Brotli.
|
|
2
|
+
* The `node:zlib` module provides compression functionality implemented using
|
|
3
|
+
* Gzip, Deflate/Inflate, and Brotli.
|
|
4
4
|
*
|
|
5
5
|
* To access it:
|
|
6
6
|
*
|
|
7
7
|
* ```js
|
|
8
|
-
* const zlib = require('zlib');
|
|
8
|
+
* const zlib = require('node:zlib');
|
|
9
9
|
* ```
|
|
10
10
|
*
|
|
11
11
|
* Compression and decompression are built around the Node.js `Streams API`.
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
* stream:
|
|
16
16
|
*
|
|
17
17
|
* ```js
|
|
18
|
-
* const { createGzip } = require('zlib');
|
|
19
|
-
* const { pipeline } = require('stream');
|
|
18
|
+
* const { createGzip } = require('node:zlib');
|
|
19
|
+
* const { pipeline } = require('node:stream');
|
|
20
20
|
* const {
|
|
21
21
|
* createReadStream,
|
|
22
|
-
* createWriteStream
|
|
23
|
-
* } = require('fs');
|
|
22
|
+
* createWriteStream,
|
|
23
|
+
* } = require('node:fs');
|
|
24
24
|
*
|
|
25
25
|
* const gzip = createGzip();
|
|
26
26
|
* const source = createReadStream('input.txt');
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
*
|
|
36
36
|
* // Or, Promisified
|
|
37
37
|
*
|
|
38
|
-
* const { promisify } = require('util');
|
|
38
|
+
* const { promisify } = require('node:util');
|
|
39
39
|
* const pipe = promisify(pipeline);
|
|
40
40
|
*
|
|
41
41
|
* async function do_gzip(input, output) {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
* It is also possible to compress or decompress data in a single step:
|
|
56
56
|
*
|
|
57
57
|
* ```js
|
|
58
|
-
* const { deflate, unzip } = require('zlib');
|
|
58
|
+
* const { deflate, unzip } = require('node:zlib');
|
|
59
59
|
*
|
|
60
60
|
* const input = '.................................';
|
|
61
61
|
* deflate(input, (err, buffer) => {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
*
|
|
78
78
|
* // Or, Promisified
|
|
79
79
|
*
|
|
80
|
-
* const { promisify } = require('util');
|
|
80
|
+
* const { promisify } = require('node:util');
|
|
81
81
|
* const do_unzip = promisify(unzip);
|
|
82
82
|
*
|
|
83
83
|
* do_unzip(buffer)
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
* });
|
|
89
89
|
* ```
|
|
90
90
|
* @since v0.5.8
|
|
91
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
91
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.1.0/lib/zlib.js)
|
|
92
92
|
*/
|
|
93
93
|
declare module 'zlib' {
|
|
94
94
|
import * as stream from 'node:stream';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `tty` module provides the `tty.ReadStream` and `tty.WriteStream`
|
|
3
|
-
*
|
|
4
|
-
* However, it can be accessed using:
|
|
2
|
+
* The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream`classes. In most cases, it will not be necessary or possible to use this module
|
|
3
|
+
* directly. However, it can be accessed using:
|
|
5
4
|
*
|
|
6
5
|
* ```js
|
|
7
|
-
* const tty = require('tty');
|
|
6
|
+
* const tty = require('node:tty');
|
|
8
7
|
* ```
|
|
9
8
|
*
|
|
10
9
|
* When Node.js detects that it is being run with a text terminal ("TTY")
|
|
@@ -22,7 +21,7 @@
|
|
|
22
21
|
*
|
|
23
22
|
* In most cases, there should be little to no reason for an application to
|
|
24
23
|
* manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes.
|
|
25
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
24
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.1.0/lib/tty.js)
|
|
26
25
|
*/
|
|
27
26
|
declare module 'tty' {
|
|
28
27
|
import * as net from 'node:net';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `url` module provides utilities for URL resolution and parsing. It can
|
|
3
|
-
* accessed using:
|
|
2
|
+
* The `node:url` module provides utilities for URL resolution and parsing. It can
|
|
3
|
+
* be accessed using:
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
|
-
* import url from 'url';
|
|
6
|
+
* import url from 'node:url';
|
|
7
7
|
* ```
|
|
8
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.1.0/lib/url.js)
|
|
9
9
|
*/
|
|
10
10
|
declare module 'url' {
|
|
11
11
|
import { Blob as NodeBlob } from 'node:buffer';
|
|
@@ -54,17 +54,11 @@ declare module 'url' {
|
|
|
54
54
|
*
|
|
55
55
|
* A `URIError` is thrown if the `auth` property is present but cannot be decoded.
|
|
56
56
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* issues can be introduced. Specifically, issues with [host name spoofing](https://hackerone.com/reports/678487) and
|
|
61
|
-
* incorrect handling of usernames and passwords have been identified.
|
|
62
|
-
*
|
|
63
|
-
* Deprecation of this API has been shelved for now primarily due to the the
|
|
64
|
-
* inability of the [WHATWG API to parse relative URLs](https://github.com/nodejs/node/issues/12682#issuecomment-1154492373).
|
|
65
|
-
* [Discussions are ongoing](https://github.com/whatwg/url/issues/531) for the best way to resolve this.
|
|
66
|
-
*
|
|
57
|
+
* `url.parse()` uses a lenient, non-standard algorithm for parsing URL
|
|
58
|
+
* strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted
|
|
59
|
+
* input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead.
|
|
67
60
|
* @since v0.1.25
|
|
61
|
+
* @deprecated Use the WHATWG URL API instead.
|
|
68
62
|
* @param urlString The URL string to parse.
|
|
69
63
|
* @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property
|
|
70
64
|
* on the returned URL object will be an unparsed, undecoded string.
|
|
@@ -79,15 +73,15 @@ declare module 'url' {
|
|
|
79
73
|
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
|
|
80
74
|
*
|
|
81
75
|
* ```js
|
|
82
|
-
* const url = require('url');
|
|
76
|
+
* const url = require('node:url');
|
|
83
77
|
* url.format({
|
|
84
78
|
* protocol: 'https',
|
|
85
79
|
* hostname: 'example.com',
|
|
86
80
|
* pathname: '/some/path',
|
|
87
81
|
* query: {
|
|
88
82
|
* page: 1,
|
|
89
|
-
* format: 'json'
|
|
90
|
-
* }
|
|
83
|
+
* format: 'json',
|
|
84
|
+
* },
|
|
91
85
|
* });
|
|
92
86
|
*
|
|
93
87
|
* // => 'https://example.com/some/path?page=1&format=json'
|
|
@@ -208,7 +202,7 @@ declare module 'url' {
|
|
|
208
202
|
* manner similar to that of a web browser resolving an anchor tag.
|
|
209
203
|
*
|
|
210
204
|
* ```js
|
|
211
|
-
* const url = require('url');
|
|
205
|
+
* const url = require('node:url');
|
|
212
206
|
* url.resolve('/one/two/three', 'four'); // '/one/two/four'
|
|
213
207
|
* url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
|
|
214
208
|
* url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
|
|
@@ -243,10 +237,8 @@ declare module 'url' {
|
|
|
243
237
|
*
|
|
244
238
|
* It performs the inverse operation to {@link domainToUnicode}.
|
|
245
239
|
*
|
|
246
|
-
* This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
|
|
247
|
-
*
|
|
248
240
|
* ```js
|
|
249
|
-
* import url from 'url';
|
|
241
|
+
* import url from 'node:url';
|
|
250
242
|
*
|
|
251
243
|
* console.log(url.domainToASCII('español.com'));
|
|
252
244
|
* // Prints xn--espaol-zwa.com
|
|
@@ -264,10 +256,8 @@ declare module 'url' {
|
|
|
264
256
|
*
|
|
265
257
|
* It performs the inverse operation to {@link domainToASCII}.
|
|
266
258
|
*
|
|
267
|
-
* This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
|
|
268
|
-
*
|
|
269
259
|
* ```js
|
|
270
|
-
* import url from 'url';
|
|
260
|
+
* import url from 'node:url';
|
|
271
261
|
*
|
|
272
262
|
* console.log(url.domainToUnicode('xn--espaol-zwa.com'));
|
|
273
263
|
* // Prints español.com
|
|
@@ -284,7 +274,7 @@ declare module 'url' {
|
|
|
284
274
|
* well as ensuring a cross-platform valid absolute path string.
|
|
285
275
|
*
|
|
286
276
|
* ```js
|
|
287
|
-
* import { fileURLToPath } from 'url';
|
|
277
|
+
* import { fileURLToPath } from 'node:url';
|
|
288
278
|
*
|
|
289
279
|
* const __filename = fileURLToPath(import.meta.url);
|
|
290
280
|
*
|
|
@@ -310,7 +300,7 @@ declare module 'url' {
|
|
|
310
300
|
* control characters are correctly encoded when converting into a File URL.
|
|
311
301
|
*
|
|
312
302
|
* ```js
|
|
313
|
-
* import { pathToFileURL } from 'url';
|
|
303
|
+
* import { pathToFileURL } from 'node:url';
|
|
314
304
|
*
|
|
315
305
|
* new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1
|
|
316
306
|
* pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX)
|
|
@@ -328,7 +318,7 @@ declare module 'url' {
|
|
|
328
318
|
* expected by the `http.request()` and `https.request()` APIs.
|
|
329
319
|
*
|
|
330
320
|
* ```js
|
|
331
|
-
* import { urlToHttpOptions } from 'url';
|
|
321
|
+
* import { urlToHttpOptions } from 'node:url';
|
|
332
322
|
* const myURL = new URL('https://a:b@測試?abc#foo');
|
|
333
323
|
*
|
|
334
324
|
* console.log(urlToHttpOptions(myURL));
|
|
@@ -376,7 +366,7 @@ declare module 'url' {
|
|
|
376
366
|
* const {
|
|
377
367
|
* Blob,
|
|
378
368
|
* resolveObjectURL,
|
|
379
|
-
* } = require('buffer');
|
|
369
|
+
* } = require('node:buffer');
|
|
380
370
|
*
|
|
381
371
|
* const blob = new Blob(['hello']);
|
|
382
372
|
* const id = URL.createObjectURL(blob);
|
|
@@ -398,7 +388,7 @@ declare module 'url' {
|
|
|
398
388
|
static createObjectURL(blob: NodeBlob): string;
|
|
399
389
|
/**
|
|
400
390
|
* Removes the stored `Blob` identified by the given ID. Attempting to revoke a
|
|
401
|
-
* ID that isn
|
|
391
|
+
* ID that isn't registered will silently fail.
|
|
402
392
|
* @since v16.7.0
|
|
403
393
|
* @experimental
|
|
404
394
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
@@ -449,7 +439,7 @@ declare module 'url' {
|
|
|
449
439
|
* // Prints example.org
|
|
450
440
|
*
|
|
451
441
|
* // Setting the hostname does not change the port
|
|
452
|
-
* myURL.hostname = 'example.com
|
|
442
|
+
* myURL.hostname = 'example.com';
|
|
453
443
|
* console.log(myURL.href);
|
|
454
444
|
* // Prints https://example.com:81/foo
|
|
455
445
|
*
|
|
@@ -512,7 +502,7 @@ declare module 'url' {
|
|
|
512
502
|
*
|
|
513
503
|
* myURL.password = '123';
|
|
514
504
|
* console.log(myURL.href);
|
|
515
|
-
* // Prints https://abc:123@example.com
|
|
505
|
+
* // Prints https://abc:123@example.com/
|
|
516
506
|
* ```
|
|
517
507
|
*
|
|
518
508
|
* Invalid URL characters included in the value assigned to the `password` property
|
|
@@ -656,14 +646,14 @@ declare module 'url' {
|
|
|
656
646
|
* character, while `URLSearchParams` will always encode it:
|
|
657
647
|
*
|
|
658
648
|
* ```js
|
|
659
|
-
* const
|
|
649
|
+
* const myURL = new URL('https://example.org/abc?foo=~bar');
|
|
660
650
|
*
|
|
661
|
-
* console.log(
|
|
651
|
+
* console.log(myURL.search); // prints ?foo=~bar
|
|
662
652
|
*
|
|
663
653
|
* // Modify the URL via searchParams...
|
|
664
|
-
*
|
|
654
|
+
* myURL.searchParams.sort();
|
|
665
655
|
*
|
|
666
|
-
* console.log(
|
|
656
|
+
* console.log(myURL.search); // prints ?foo=%7Ebar
|
|
667
657
|
* ```
|
|
668
658
|
*/
|
|
669
659
|
readonly searchParams: URLSearchParams;
|
|
@@ -835,7 +825,7 @@ declare module 'url' {
|
|
|
835
825
|
set(name: string, value: string): void;
|
|
836
826
|
/**
|
|
837
827
|
* The total number of parameter entries.
|
|
838
|
-
* @since
|
|
828
|
+
* @since v19.8.0
|
|
839
829
|
*/
|
|
840
830
|
readonly size: number;
|
|
841
831
|
/**
|