@types/node 24.12.0 → 25.5.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 v24.12/README.md → node/README.md +2 -2
- node v24.12/assert/strict.d.ts → node/assert/strict.d.ts +5 -11
- node v24.12/assert.d.ts → node/assert.d.ts +11 -171
- node v24.12/async_hooks.d.ts → node/async_hooks.d.ts +8 -8
- node v24.12/buffer.buffer.d.ts → node/buffer.buffer.d.ts +1 -7
- node v24.12/buffer.d.ts → node/buffer.d.ts +44 -168
- node v24.12/child_process.d.ts → node/child_process.d.ts +21 -64
- node/cluster.d.ts +486 -0
- node/console.d.ts +151 -0
- node v24.12/constants.d.ts → node/constants.d.ts +3 -4
- node v24.12/crypto.d.ts → node/crypto.d.ts +287 -1639
- node v24.12/dgram.d.ts → node/dgram.d.ts +15 -51
- node v24.12/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +4 -4
- node v24.12/dns/promises.d.ts → node/dns/promises.d.ts +3 -3
- node v24.12/dns.d.ts → node/dns.d.ts +131 -132
- node v24.12/domain.d.ts → node/domain.d.ts +13 -17
- node v24.12/events.d.ts → node/events.d.ts +866 -795
- node v24.12/fs/promises.d.ts → node/fs/promises.d.ts +7 -8
- node v24.12/fs.d.ts → node/fs.d.ts +419 -455
- node v24.12/globals.d.ts → node/globals.d.ts +6 -26
- node/globals.typedarray.d.ts +101 -0
- node v24.12/http.d.ts → node/http.d.ts +310 -276
- node v24.12/http2.d.ts → node/http2.d.ts +528 -804
- node v24.12/https.d.ts → node/https.d.ts +63 -243
- node v24.12/index.d.ts → node/index.d.ts +15 -1
- node/inspector/promises.d.ts +41 -0
- node v24.12/inspector.d.ts → node/inspector.d.ts +42 -50
- node v24.12/inspector.generated.d.ts → node/inspector.generated.d.ts +572 -417
- node v24.12/module.d.ts → node/module.d.ts +47 -195
- node v24.12/net.d.ts → node/net.d.ts +68 -189
- node v24.12/os.d.ts → node/os.d.ts +6 -6
- node v24.12/package.json → node/package.json +3 -3
- node/path/posix.d.ts +8 -0
- node/path/win32.d.ts +8 -0
- node/path.d.ts +187 -0
- node/perf_hooks.d.ts +643 -0
- node v24.12/process.d.ts → node/process.d.ts +219 -127
- node v24.12/punycode.d.ts → node/punycode.d.ts +5 -5
- node v24.12/querystring.d.ts → node/querystring.d.ts +4 -4
- node/quic.d.ts +910 -0
- node v24.12/readline/promises.d.ts → node/readline/promises.d.ts +3 -3
- node v24.12/readline.d.ts → node/readline.d.ts +68 -120
- node v24.12/repl.d.ts → node/repl.d.ts +75 -98
- node v24.12/sea.d.ts → node/sea.d.ts +1 -1
- node v24.12/sqlite.d.ts → node/sqlite.d.ts +137 -30
- node v24.12/stream/consumers.d.ts → node/stream/consumers.d.ts +10 -10
- node/stream/promises.d.ts +211 -0
- node/stream/web.d.ts +296 -0
- node v24.12/stream.d.ts → node/stream.d.ts +565 -478
- node v24.12/string_decoder.d.ts → node/string_decoder.d.ts +4 -4
- node/test/reporters.d.ts +96 -0
- node v24.12/test.d.ts → node/test.d.ts +134 -199
- node v24.12/timers/promises.d.ts → node/timers/promises.d.ts +4 -4
- node v24.12/timers.d.ts → node/timers.d.ts +4 -130
- node v24.12/tls.d.ts → node/tls.d.ts +109 -179
- node v24.12/trace_events.d.ts → node/trace_events.d.ts +9 -9
- node v24.12/ts5.6/buffer.buffer.d.ts → node/ts5.6/buffer.buffer.d.ts +1 -7
- node v24.12/ts5.6/index.d.ts → node/ts5.6/index.d.ts +15 -1
- node v24.12/ts5.7/index.d.ts → node/ts5.7/index.d.ts +15 -1
- node v24.12/tty.d.ts → node/tty.d.ts +58 -16
- node/url.d.ts +541 -0
- node/util/types.d.ts +558 -0
- node v24.12/util.d.ts → node/util.d.ts +150 -796
- node v24.12/v8.d.ts → node/v8.d.ts +31 -21
- node v24.12/vm.d.ts → node/vm.d.ts +43 -30
- node v24.12/wasi.d.ts → node/wasi.d.ts +4 -4
- node v24.12/web-globals/abortcontroller.d.ts → node/web-globals/abortcontroller.d.ts +27 -2
- node/web-globals/blob.d.ts +23 -0
- node/web-globals/console.d.ts +9 -0
- node v24.12/web-globals/crypto.d.ts → node/web-globals/crypto.d.ts +7 -0
- node/web-globals/encoding.d.ts +11 -0
- node v24.12/web-globals/events.d.ts → node/web-globals/events.d.ts +9 -0
- node v24.12/web-globals/fetch.d.ts → node/web-globals/fetch.d.ts +7 -0
- node/web-globals/importmeta.d.ts +13 -0
- node/web-globals/messaging.d.ts +23 -0
- node/web-globals/performance.d.ts +45 -0
- node/web-globals/streams.d.ts +115 -0
- node/web-globals/timers.d.ts +44 -0
- node/web-globals/url.d.ts +24 -0
- node v24.12/worker_threads.d.ts → node/worker_threads.d.ts +186 -363
- node v24.12/zlib.d.ts → node/zlib.d.ts +8 -71
- node v24.12/cluster.d.ts +0 -578
- node v24.12/console.d.ts +0 -453
- node v24.12/globals.typedarray.d.ts +0 -41
- node v24.12/path.d.ts +0 -200
- node v24.12/perf_hooks.d.ts +0 -1042
- node v24.12/stream/promises.d.ts +0 -90
- node v24.12/stream/web.d.ts +0 -573
- node v24.12/url.d.ts +0 -1057
- node v24.12/web-globals/streams.d.ts +0 -22
- {node v24.12 → node}/LICENSE +0 -0
- {node v24.12 → node}/compatibility/iterators.d.ts +0 -0
- {node v24.12 → node}/ts5.6/compatibility/float16array.d.ts +0 -0
- {node v24.12 → node}/ts5.6/globals.typedarray.d.ts +0 -0
- {node v24.12 → node}/ts5.7/compatibility/float16array.d.ts +0 -0
- {node v24.12 → node}/web-globals/domexception.d.ts +0 -0
- {node v24.12 → node}/web-globals/navigator.d.ts +0 -0
- {node v24.12 → node}/web-globals/storage.d.ts +0 -0
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
* ```js
|
|
11
11
|
* import net from 'node:net';
|
|
12
12
|
* ```
|
|
13
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
13
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/net.js)
|
|
14
14
|
*/
|
|
15
|
-
declare module "net" {
|
|
15
|
+
declare module "node:net" {
|
|
16
16
|
import { NonSharedBuffer } from "node:buffer";
|
|
17
|
-
import * as stream from "node:stream";
|
|
18
|
-
import { Abortable, EventEmitter } from "node:events";
|
|
19
17
|
import * as dns from "node:dns";
|
|
18
|
+
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
|
|
19
|
+
import * as stream from "node:stream";
|
|
20
20
|
type LookupFunction = (
|
|
21
21
|
hostname: string,
|
|
22
22
|
options: dns.LookupOptions,
|
|
@@ -34,6 +34,10 @@ declare module "net" {
|
|
|
34
34
|
readable?: boolean | undefined;
|
|
35
35
|
writable?: boolean | undefined;
|
|
36
36
|
signal?: AbortSignal | undefined;
|
|
37
|
+
noDelay?: boolean | undefined;
|
|
38
|
+
keepAlive?: boolean | undefined;
|
|
39
|
+
keepAliveInitialDelay?: number | undefined;
|
|
40
|
+
blockList?: BlockList | undefined;
|
|
37
41
|
}
|
|
38
42
|
interface OnReadOpts {
|
|
39
43
|
buffer: Uint8Array | (() => Uint8Array);
|
|
@@ -52,9 +56,6 @@ declare module "net" {
|
|
|
52
56
|
hints?: number | undefined;
|
|
53
57
|
family?: number | undefined;
|
|
54
58
|
lookup?: LookupFunction | undefined;
|
|
55
|
-
noDelay?: boolean | undefined;
|
|
56
|
-
keepAlive?: boolean | undefined;
|
|
57
|
-
keepAliveInitialDelay?: number | undefined;
|
|
58
59
|
/**
|
|
59
60
|
* @since v18.13.0
|
|
60
61
|
*/
|
|
@@ -63,13 +64,23 @@ declare module "net" {
|
|
|
63
64
|
* @since v18.13.0
|
|
64
65
|
*/
|
|
65
66
|
autoSelectFamilyAttemptTimeout?: number | undefined;
|
|
66
|
-
blockList?: BlockList | undefined;
|
|
67
67
|
}
|
|
68
68
|
interface IpcSocketConnectOpts {
|
|
69
69
|
path: string;
|
|
70
70
|
}
|
|
71
71
|
type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
|
|
72
72
|
type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed";
|
|
73
|
+
interface SocketEventMap extends Omit<stream.DuplexEventMap, "close"> {
|
|
74
|
+
"close": [hadError: boolean];
|
|
75
|
+
"connect": [];
|
|
76
|
+
"connectionAttempt": [ip: string, port: number, family: number];
|
|
77
|
+
"connectionAttemptFailed": [ip: string, port: number, family: number, error: Error];
|
|
78
|
+
"connectionAttemptTimeout": [ip: string, port: number, family: number];
|
|
79
|
+
"data": [data: string | NonSharedBuffer];
|
|
80
|
+
"lookup": [err: Error | null, address: string, family: number | null, host: string];
|
|
81
|
+
"ready": [];
|
|
82
|
+
"timeout": [];
|
|
83
|
+
}
|
|
73
84
|
/**
|
|
74
85
|
* This class is an abstraction of a TCP socket or a streaming `IPC` endpoint
|
|
75
86
|
* (uses named pipes on Windows, and Unix domain sockets otherwise). It is also
|
|
@@ -354,141 +365,45 @@ declare module "net" {
|
|
|
354
365
|
end(callback?: () => void): this;
|
|
355
366
|
end(buffer: Uint8Array | string, callback?: () => void): this;
|
|
356
367
|
end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
listener: (ip: string, port: number, family: number, error: Error) => void,
|
|
379
|
-
): this;
|
|
380
|
-
addListener(
|
|
381
|
-
event: "connectionAttemptTimeout",
|
|
382
|
-
listener: (ip: string, port: number, family: number) => void,
|
|
368
|
+
// #region InternalEventEmitter
|
|
369
|
+
addListener<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
|
|
370
|
+
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
371
|
+
emit<E extends keyof SocketEventMap>(eventName: E, ...args: SocketEventMap[E]): boolean;
|
|
372
|
+
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
373
|
+
listenerCount<E extends keyof SocketEventMap>(
|
|
374
|
+
eventName: E,
|
|
375
|
+
listener?: (...args: SocketEventMap[E]) => void,
|
|
376
|
+
): number;
|
|
377
|
+
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
|
378
|
+
listeners<E extends keyof SocketEventMap>(eventName: E): ((...args: SocketEventMap[E]) => void)[];
|
|
379
|
+
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
380
|
+
off<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
|
|
381
|
+
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
382
|
+
on<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
|
|
383
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
384
|
+
once<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
|
|
385
|
+
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
386
|
+
prependListener<E extends keyof SocketEventMap>(
|
|
387
|
+
eventName: E,
|
|
388
|
+
listener: (...args: SocketEventMap[E]) => void,
|
|
383
389
|
): this;
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
addListener(
|
|
389
|
-
event: "lookup",
|
|
390
|
-
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
|
390
|
+
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
391
|
+
prependOnceListener<E extends keyof SocketEventMap>(
|
|
392
|
+
eventName: E,
|
|
393
|
+
listener: (...args: SocketEventMap[E]) => void,
|
|
391
394
|
): this;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
emit(event: "drain"): boolean;
|
|
402
|
-
emit(event: "end"): boolean;
|
|
403
|
-
emit(event: "error", err: Error): boolean;
|
|
404
|
-
emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean;
|
|
405
|
-
emit(event: "ready"): boolean;
|
|
406
|
-
emit(event: "timeout"): boolean;
|
|
407
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
408
|
-
on(event: "close", listener: (hadError: boolean) => void): this;
|
|
409
|
-
on(event: "connect", listener: () => void): this;
|
|
410
|
-
on(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
|
411
|
-
on(
|
|
412
|
-
event: "connectionAttemptFailed",
|
|
413
|
-
listener: (ip: string, port: number, family: number, error: Error) => void,
|
|
395
|
+
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
396
|
+
rawListeners<E extends keyof SocketEventMap>(eventName: E): ((...args: SocketEventMap[E]) => void)[];
|
|
397
|
+
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
398
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
399
|
+
removeAllListeners<E extends keyof SocketEventMap>(eventName?: E): this;
|
|
400
|
+
removeAllListeners(eventName?: string | symbol): this;
|
|
401
|
+
removeListener<E extends keyof SocketEventMap>(
|
|
402
|
+
eventName: E,
|
|
403
|
+
listener: (...args: SocketEventMap[E]) => void,
|
|
414
404
|
): this;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
on(event: "drain", listener: () => void): this;
|
|
418
|
-
on(event: "end", listener: () => void): this;
|
|
419
|
-
on(event: "error", listener: (err: Error) => void): this;
|
|
420
|
-
on(
|
|
421
|
-
event: "lookup",
|
|
422
|
-
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
|
423
|
-
): this;
|
|
424
|
-
on(event: "ready", listener: () => void): this;
|
|
425
|
-
on(event: "timeout", listener: () => void): this;
|
|
426
|
-
once(event: string, listener: (...args: any[]) => void): this;
|
|
427
|
-
once(event: "close", listener: (hadError: boolean) => void): this;
|
|
428
|
-
once(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
|
429
|
-
once(
|
|
430
|
-
event: "connectionAttemptFailed",
|
|
431
|
-
listener: (ip: string, port: number, family: number, error: Error) => void,
|
|
432
|
-
): this;
|
|
433
|
-
once(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this;
|
|
434
|
-
once(event: "connect", listener: () => void): this;
|
|
435
|
-
once(event: "data", listener: (data: NonSharedBuffer) => void): this;
|
|
436
|
-
once(event: "drain", listener: () => void): this;
|
|
437
|
-
once(event: "end", listener: () => void): this;
|
|
438
|
-
once(event: "error", listener: (err: Error) => void): this;
|
|
439
|
-
once(
|
|
440
|
-
event: "lookup",
|
|
441
|
-
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
|
442
|
-
): this;
|
|
443
|
-
once(event: "ready", listener: () => void): this;
|
|
444
|
-
once(event: "timeout", listener: () => void): this;
|
|
445
|
-
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
446
|
-
prependListener(event: "close", listener: (hadError: boolean) => void): this;
|
|
447
|
-
prependListener(event: "connect", listener: () => void): this;
|
|
448
|
-
prependListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
|
449
|
-
prependListener(
|
|
450
|
-
event: "connectionAttemptFailed",
|
|
451
|
-
listener: (ip: string, port: number, family: number, error: Error) => void,
|
|
452
|
-
): this;
|
|
453
|
-
prependListener(
|
|
454
|
-
event: "connectionAttemptTimeout",
|
|
455
|
-
listener: (ip: string, port: number, family: number) => void,
|
|
456
|
-
): this;
|
|
457
|
-
prependListener(event: "data", listener: (data: NonSharedBuffer) => void): this;
|
|
458
|
-
prependListener(event: "drain", listener: () => void): this;
|
|
459
|
-
prependListener(event: "end", listener: () => void): this;
|
|
460
|
-
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
461
|
-
prependListener(
|
|
462
|
-
event: "lookup",
|
|
463
|
-
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
|
464
|
-
): this;
|
|
465
|
-
prependListener(event: "ready", listener: () => void): this;
|
|
466
|
-
prependListener(event: "timeout", listener: () => void): this;
|
|
467
|
-
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
468
|
-
prependOnceListener(event: "close", listener: (hadError: boolean) => void): this;
|
|
469
|
-
prependOnceListener(event: "connect", listener: () => void): this;
|
|
470
|
-
prependOnceListener(
|
|
471
|
-
event: "connectionAttempt",
|
|
472
|
-
listener: (ip: string, port: number, family: number) => void,
|
|
473
|
-
): this;
|
|
474
|
-
prependOnceListener(
|
|
475
|
-
event: "connectionAttemptFailed",
|
|
476
|
-
listener: (ip: string, port: number, family: number, error: Error) => void,
|
|
477
|
-
): this;
|
|
478
|
-
prependOnceListener(
|
|
479
|
-
event: "connectionAttemptTimeout",
|
|
480
|
-
listener: (ip: string, port: number, family: number) => void,
|
|
481
|
-
): this;
|
|
482
|
-
prependOnceListener(event: "data", listener: (data: NonSharedBuffer) => void): this;
|
|
483
|
-
prependOnceListener(event: "drain", listener: () => void): this;
|
|
484
|
-
prependOnceListener(event: "end", listener: () => void): this;
|
|
485
|
-
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
486
|
-
prependOnceListener(
|
|
487
|
-
event: "lookup",
|
|
488
|
-
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
|
489
|
-
): this;
|
|
490
|
-
prependOnceListener(event: "ready", listener: () => void): this;
|
|
491
|
-
prependOnceListener(event: "timeout", listener: () => void): this;
|
|
405
|
+
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
406
|
+
// #endregion
|
|
492
407
|
}
|
|
493
408
|
interface ListenOptions extends Abortable {
|
|
494
409
|
backlog?: number | undefined;
|
|
@@ -536,7 +451,7 @@ declare module "net" {
|
|
|
536
451
|
keepAliveInitialDelay?: number | undefined;
|
|
537
452
|
/**
|
|
538
453
|
* Optionally overrides all `net.Socket`s' `readableHighWaterMark` and `writableHighWaterMark`.
|
|
539
|
-
* @default See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-
|
|
454
|
+
* @default See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode).
|
|
540
455
|
* @since v18.17.0, v20.1.0
|
|
541
456
|
*/
|
|
542
457
|
highWaterMark?: number | undefined;
|
|
@@ -558,11 +473,18 @@ declare module "net" {
|
|
|
558
473
|
remotePort?: number;
|
|
559
474
|
remoteFamily?: string;
|
|
560
475
|
}
|
|
476
|
+
interface ServerEventMap {
|
|
477
|
+
"close": [];
|
|
478
|
+
"connection": [socket: Socket];
|
|
479
|
+
"error": [err: Error];
|
|
480
|
+
"listening": [];
|
|
481
|
+
"drop": [data?: DropArgument];
|
|
482
|
+
}
|
|
561
483
|
/**
|
|
562
484
|
* This class is used to create a TCP or `IPC` server.
|
|
563
485
|
* @since v0.1.90
|
|
564
486
|
*/
|
|
565
|
-
class Server
|
|
487
|
+
class Server implements EventEmitter {
|
|
566
488
|
constructor(connectionListener?: (socket: Socket) => void);
|
|
567
489
|
constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void);
|
|
568
490
|
/**
|
|
@@ -688,56 +610,13 @@ declare module "net" {
|
|
|
688
610
|
* @since v5.7.0
|
|
689
611
|
*/
|
|
690
612
|
readonly listening: boolean;
|
|
691
|
-
/**
|
|
692
|
-
* events.EventEmitter
|
|
693
|
-
* 1. close
|
|
694
|
-
* 2. connection
|
|
695
|
-
* 3. error
|
|
696
|
-
* 4. listening
|
|
697
|
-
* 5. drop
|
|
698
|
-
*/
|
|
699
|
-
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
700
|
-
addListener(event: "close", listener: () => void): this;
|
|
701
|
-
addListener(event: "connection", listener: (socket: Socket) => void): this;
|
|
702
|
-
addListener(event: "error", listener: (err: Error) => void): this;
|
|
703
|
-
addListener(event: "listening", listener: () => void): this;
|
|
704
|
-
addListener(event: "drop", listener: (data?: DropArgument) => void): this;
|
|
705
|
-
emit(event: string | symbol, ...args: any[]): boolean;
|
|
706
|
-
emit(event: "close"): boolean;
|
|
707
|
-
emit(event: "connection", socket: Socket): boolean;
|
|
708
|
-
emit(event: "error", err: Error): boolean;
|
|
709
|
-
emit(event: "listening"): boolean;
|
|
710
|
-
emit(event: "drop", data?: DropArgument): boolean;
|
|
711
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
712
|
-
on(event: "close", listener: () => void): this;
|
|
713
|
-
on(event: "connection", listener: (socket: Socket) => void): this;
|
|
714
|
-
on(event: "error", listener: (err: Error) => void): this;
|
|
715
|
-
on(event: "listening", listener: () => void): this;
|
|
716
|
-
on(event: "drop", listener: (data?: DropArgument) => void): this;
|
|
717
|
-
once(event: string, listener: (...args: any[]) => void): this;
|
|
718
|
-
once(event: "close", listener: () => void): this;
|
|
719
|
-
once(event: "connection", listener: (socket: Socket) => void): this;
|
|
720
|
-
once(event: "error", listener: (err: Error) => void): this;
|
|
721
|
-
once(event: "listening", listener: () => void): this;
|
|
722
|
-
once(event: "drop", listener: (data?: DropArgument) => void): this;
|
|
723
|
-
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
724
|
-
prependListener(event: "close", listener: () => void): this;
|
|
725
|
-
prependListener(event: "connection", listener: (socket: Socket) => void): this;
|
|
726
|
-
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
727
|
-
prependListener(event: "listening", listener: () => void): this;
|
|
728
|
-
prependListener(event: "drop", listener: (data?: DropArgument) => void): this;
|
|
729
|
-
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
730
|
-
prependOnceListener(event: "close", listener: () => void): this;
|
|
731
|
-
prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
|
|
732
|
-
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
733
|
-
prependOnceListener(event: "listening", listener: () => void): this;
|
|
734
|
-
prependOnceListener(event: "drop", listener: (data?: DropArgument) => void): this;
|
|
735
613
|
/**
|
|
736
614
|
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
|
|
737
615
|
* @since v20.5.0
|
|
738
616
|
*/
|
|
739
617
|
[Symbol.asyncDispose](): Promise<void>;
|
|
740
618
|
}
|
|
619
|
+
interface Server extends InternalEventEmitter<ServerEventMap> {}
|
|
741
620
|
type IPVersion = "ipv4" | "ipv6";
|
|
742
621
|
/**
|
|
743
622
|
* The `BlockList` object can be used with some network APIs to specify rules for
|
|
@@ -946,7 +825,7 @@ declare module "net" {
|
|
|
946
825
|
function setDefaultAutoSelectFamily(value: boolean): void;
|
|
947
826
|
/**
|
|
948
827
|
* Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
|
|
949
|
-
* The initial default value is `
|
|
828
|
+
* The initial default value is `500` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`.
|
|
950
829
|
* @returns The current default value of the `autoSelectFamilyAttemptTimeout` option.
|
|
951
830
|
* @since v19.8.0, v18.8.0
|
|
952
831
|
*/
|
|
@@ -1049,6 +928,6 @@ declare module "net" {
|
|
|
1049
928
|
static parse(input: string): SocketAddress | undefined;
|
|
1050
929
|
}
|
|
1051
930
|
}
|
|
1052
|
-
declare module "
|
|
1053
|
-
export * from "net";
|
|
931
|
+
declare module "net" {
|
|
932
|
+
export * from "node:net";
|
|
1054
933
|
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* ```js
|
|
6
6
|
* import os from 'node:os';
|
|
7
7
|
* ```
|
|
8
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/os.js)
|
|
9
9
|
*/
|
|
10
|
-
declare module "os" {
|
|
10
|
+
declare module "node:os" {
|
|
11
11
|
import { NonSharedBuffer } from "buffer";
|
|
12
12
|
interface CpuInfo {
|
|
13
13
|
model: string;
|
|
@@ -251,7 +251,7 @@ declare module "os" {
|
|
|
251
251
|
* environment variables for the home directory before falling back to the
|
|
252
252
|
* operating system response.
|
|
253
253
|
*
|
|
254
|
-
* Throws a [`SystemError`](https://nodejs.org/docs/latest-
|
|
254
|
+
* Throws a [`SystemError`](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`.
|
|
255
255
|
* @since v6.0.0
|
|
256
256
|
*/
|
|
257
257
|
function userInfo(options?: UserInfoOptionsWithStringEncoding): UserInfo<string>;
|
|
@@ -431,7 +431,7 @@ declare module "os" {
|
|
|
431
431
|
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`,
|
|
432
432
|
* `'mips'`, `'mipsel'`, `'ppc64'`, `'riscv64'`, `'s390x'`, and `'x64'`.
|
|
433
433
|
*
|
|
434
|
-
* The return value is equivalent to [process.arch](https://nodejs.org/docs/latest-
|
|
434
|
+
* The return value is equivalent to [process.arch](https://nodejs.org/docs/latest-v25.x/api/process.html#processarch).
|
|
435
435
|
* @since v0.5.0
|
|
436
436
|
*/
|
|
437
437
|
function arch(): NodeJS.Architecture;
|
|
@@ -502,6 +502,6 @@ declare module "os" {
|
|
|
502
502
|
function setPriority(priority: number): void;
|
|
503
503
|
function setPriority(pid: number, priority: number): void;
|
|
504
504
|
}
|
|
505
|
-
declare module "
|
|
506
|
-
export * from "os";
|
|
505
|
+
declare module "os" {
|
|
506
|
+
export * from "node:os";
|
|
507
507
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.5.0",
|
|
4
4
|
"description": "TypeScript definitions for node",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -147,9 +147,9 @@
|
|
|
147
147
|
},
|
|
148
148
|
"scripts": {},
|
|
149
149
|
"dependencies": {
|
|
150
|
-
"undici-types": "~7.
|
|
150
|
+
"undici-types": "~7.18.0"
|
|
151
151
|
},
|
|
152
152
|
"peerDependencies": {},
|
|
153
|
-
"typesPublisherContentHash": "
|
|
153
|
+
"typesPublisherContentHash": "4b6968335abe1dc64bd6086fd546d6e9c50f986c37d49de8073f4ed1c900057c",
|
|
154
154
|
"typeScriptVersion": "5.2"
|
|
155
155
|
}
|
node/path/posix.d.ts
ADDED
node/path/win32.d.ts
ADDED
node/path.d.ts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `node:path` module provides utilities for working with file and directory
|
|
3
|
+
* paths. It can be accessed using:
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* import path from 'node:path';
|
|
7
|
+
* ```
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/path.js)
|
|
9
|
+
*/
|
|
10
|
+
declare module "node:path" {
|
|
11
|
+
namespace path {
|
|
12
|
+
/**
|
|
13
|
+
* A parsed path object generated by path.parse() or consumed by path.format().
|
|
14
|
+
*/
|
|
15
|
+
interface ParsedPath {
|
|
16
|
+
/**
|
|
17
|
+
* The root of the path such as '/' or 'c:\'
|
|
18
|
+
*/
|
|
19
|
+
root: string;
|
|
20
|
+
/**
|
|
21
|
+
* The full directory path such as '/home/user/dir' or 'c:\path\dir'
|
|
22
|
+
*/
|
|
23
|
+
dir: string;
|
|
24
|
+
/**
|
|
25
|
+
* The file name including extension (if any) such as 'index.html'
|
|
26
|
+
*/
|
|
27
|
+
base: string;
|
|
28
|
+
/**
|
|
29
|
+
* The file extension (if any) such as '.html'
|
|
30
|
+
*/
|
|
31
|
+
ext: string;
|
|
32
|
+
/**
|
|
33
|
+
* The file name without extension (if any) such as 'index'
|
|
34
|
+
*/
|
|
35
|
+
name: string;
|
|
36
|
+
}
|
|
37
|
+
interface FormatInputPathObject {
|
|
38
|
+
/**
|
|
39
|
+
* The root of the path such as '/' or 'c:\'
|
|
40
|
+
*/
|
|
41
|
+
root?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The full directory path such as '/home/user/dir' or 'c:\path\dir'
|
|
44
|
+
*/
|
|
45
|
+
dir?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* The file name including extension (if any) such as 'index.html'
|
|
48
|
+
*/
|
|
49
|
+
base?: string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* The file extension (if any) such as '.html'
|
|
52
|
+
*/
|
|
53
|
+
ext?: string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The file name without extension (if any) such as 'index'
|
|
56
|
+
*/
|
|
57
|
+
name?: string | undefined;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Normalize a string path, reducing '..' and '.' parts.
|
|
61
|
+
* When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. If the path is a zero-length string, '.' is returned, representing the current working directory.
|
|
62
|
+
*
|
|
63
|
+
* @param path string path to normalize.
|
|
64
|
+
* @throws {TypeError} if `path` is not a string.
|
|
65
|
+
*/
|
|
66
|
+
function normalize(path: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Join all arguments together and normalize the resulting path.
|
|
69
|
+
*
|
|
70
|
+
* @param paths paths to join.
|
|
71
|
+
* @throws {TypeError} if any of the path segments is not a string.
|
|
72
|
+
*/
|
|
73
|
+
function join(...paths: string[]): string;
|
|
74
|
+
/**
|
|
75
|
+
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
|
|
76
|
+
*
|
|
77
|
+
* Starting from leftmost {from} parameter, resolves {to} to an absolute path.
|
|
78
|
+
*
|
|
79
|
+
* If {to} isn't already absolute, {from} arguments are prepended in right to left order,
|
|
80
|
+
* until an absolute path is found. If after using all {from} paths still no absolute path is found,
|
|
81
|
+
* the current working directory is used as well. The resulting path is normalized,
|
|
82
|
+
* and trailing slashes are removed unless the path gets resolved to the root directory.
|
|
83
|
+
*
|
|
84
|
+
* @param paths A sequence of paths or path segments.
|
|
85
|
+
* @throws {TypeError} if any of the arguments is not a string.
|
|
86
|
+
*/
|
|
87
|
+
function resolve(...paths: string[]): string;
|
|
88
|
+
/**
|
|
89
|
+
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
|
|
90
|
+
* @param path The path to glob-match against.
|
|
91
|
+
* @param pattern The glob to check the path against.
|
|
92
|
+
* @returns Whether or not the `path` matched the `pattern`.
|
|
93
|
+
* @throws {TypeError} if `path` or `pattern` are not strings.
|
|
94
|
+
* @since v22.5.0
|
|
95
|
+
*/
|
|
96
|
+
function matchesGlob(path: string, pattern: string): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
|
|
99
|
+
*
|
|
100
|
+
* If the given {path} is a zero-length string, `false` will be returned.
|
|
101
|
+
*
|
|
102
|
+
* @param path path to test.
|
|
103
|
+
* @throws {TypeError} if `path` is not a string.
|
|
104
|
+
*/
|
|
105
|
+
function isAbsolute(path: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Solve the relative path from {from} to {to} based on the current working directory.
|
|
108
|
+
* At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
|
|
109
|
+
*
|
|
110
|
+
* @throws {TypeError} if either `from` or `to` is not a string.
|
|
111
|
+
*/
|
|
112
|
+
function relative(from: string, to: string): string;
|
|
113
|
+
/**
|
|
114
|
+
* Return the directory name of a path. Similar to the Unix dirname command.
|
|
115
|
+
*
|
|
116
|
+
* @param path the path to evaluate.
|
|
117
|
+
* @throws {TypeError} if `path` is not a string.
|
|
118
|
+
*/
|
|
119
|
+
function dirname(path: string): string;
|
|
120
|
+
/**
|
|
121
|
+
* Return the last portion of a path. Similar to the Unix basename command.
|
|
122
|
+
* Often used to extract the file name from a fully qualified path.
|
|
123
|
+
*
|
|
124
|
+
* @param path the path to evaluate.
|
|
125
|
+
* @param suffix optionally, an extension to remove from the result.
|
|
126
|
+
* @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
|
|
127
|
+
*/
|
|
128
|
+
function basename(path: string, suffix?: string): string;
|
|
129
|
+
/**
|
|
130
|
+
* Return the extension of the path, from the last '.' to end of string in the last portion of the path.
|
|
131
|
+
* If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
|
|
132
|
+
*
|
|
133
|
+
* @param path the path to evaluate.
|
|
134
|
+
* @throws {TypeError} if `path` is not a string.
|
|
135
|
+
*/
|
|
136
|
+
function extname(path: string): string;
|
|
137
|
+
/**
|
|
138
|
+
* The platform-specific file separator. '\\' or '/'.
|
|
139
|
+
*/
|
|
140
|
+
const sep: "\\" | "/";
|
|
141
|
+
/**
|
|
142
|
+
* The platform-specific file delimiter. ';' or ':'.
|
|
143
|
+
*/
|
|
144
|
+
const delimiter: ";" | ":";
|
|
145
|
+
/**
|
|
146
|
+
* Returns an object from a path string - the opposite of format().
|
|
147
|
+
*
|
|
148
|
+
* @param path path to evaluate.
|
|
149
|
+
* @throws {TypeError} if `path` is not a string.
|
|
150
|
+
*/
|
|
151
|
+
function parse(path: string): ParsedPath;
|
|
152
|
+
/**
|
|
153
|
+
* Returns a path string from an object - the opposite of parse().
|
|
154
|
+
*
|
|
155
|
+
* @param pathObject path to evaluate.
|
|
156
|
+
*/
|
|
157
|
+
function format(pathObject: FormatInputPathObject): string;
|
|
158
|
+
/**
|
|
159
|
+
* On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
|
|
160
|
+
* If path is not a string, path will be returned without modifications.
|
|
161
|
+
* This method is meaningful only on Windows system.
|
|
162
|
+
* On POSIX systems, the method is non-operational and always returns path without modifications.
|
|
163
|
+
*/
|
|
164
|
+
function toNamespacedPath(path: string): string;
|
|
165
|
+
}
|
|
166
|
+
namespace path {
|
|
167
|
+
export {
|
|
168
|
+
/**
|
|
169
|
+
* The `path.posix` property provides access to POSIX specific implementations of the `path` methods.
|
|
170
|
+
*
|
|
171
|
+
* The API is accessible via `require('node:path').posix` or `require('node:path/posix')`.
|
|
172
|
+
*/
|
|
173
|
+
path as posix,
|
|
174
|
+
/**
|
|
175
|
+
* The `path.win32` property provides access to Windows-specific implementations of the `path` methods.
|
|
176
|
+
*
|
|
177
|
+
* The API is accessible via `require('node:path').win32` or `require('node:path/win32')`.
|
|
178
|
+
*/
|
|
179
|
+
path as win32,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
export = path;
|
|
183
|
+
}
|
|
184
|
+
declare module "path" {
|
|
185
|
+
import path = require("node:path");
|
|
186
|
+
export = path;
|
|
187
|
+
}
|