@types/node 24.9.0 → 24.9.2
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/buffer.buffer.d.ts +9 -0
- node/buffer.d.ts +8 -4
- node/child_process.d.ts +50 -33
- node/crypto.d.ts +180 -158
- node/dgram.d.ts +9 -8
- node/fs/promises.d.ts +39 -21
- node/fs.d.ts +89 -76
- node/globals.typedarray.d.ts +19 -0
- node/http.d.ts +41 -22
- node/http2.d.ts +29 -22
- node/https.d.ts +82 -50
- node/net.d.ts +7 -6
- node/os.d.ts +3 -2
- node/package.json +2 -2
- node/process.d.ts +6 -5
- node/sqlite.d.ts +6 -7
- node/stream/consumers.d.ts +2 -2
- node/string_decoder.d.ts +2 -2
- node/tls.d.ts +88 -64
- node/ts5.6/buffer.buffer.d.ts +10 -2
- node/ts5.6/globals.typedarray.d.ts +16 -0
- node/url.d.ts +2 -2
- node/util.d.ts +1 -1
- node/v8.d.ts +4 -3
- node/vm.d.ts +4 -3
- node/zlib.d.ts +25 -24
node/dgram.d.ts
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/dgram.js)
|
|
27
27
|
*/
|
|
28
28
|
declare module "dgram" {
|
|
29
|
+
import { NonSharedBuffer } from "node:buffer";
|
|
29
30
|
import { AddressInfo, BlockList } from "node:net";
|
|
30
31
|
import * as dns from "node:dns";
|
|
31
32
|
import { Abortable, EventEmitter } from "node:events";
|
|
@@ -85,8 +86,8 @@ declare module "dgram" {
|
|
|
85
86
|
* @param options Available options are:
|
|
86
87
|
* @param callback Attached as a listener for `'message'` events. Optional.
|
|
87
88
|
*/
|
|
88
|
-
function createSocket(type: SocketType, callback?: (msg:
|
|
89
|
-
function createSocket(options: SocketOptions, callback?: (msg:
|
|
89
|
+
function createSocket(type: SocketType, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
|
|
90
|
+
function createSocket(options: SocketOptions, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
|
|
90
91
|
/**
|
|
91
92
|
* Encapsulates the datagram functionality.
|
|
92
93
|
*
|
|
@@ -556,37 +557,37 @@ declare module "dgram" {
|
|
|
556
557
|
addListener(event: "connect", listener: () => void): this;
|
|
557
558
|
addListener(event: "error", listener: (err: Error) => void): this;
|
|
558
559
|
addListener(event: "listening", listener: () => void): this;
|
|
559
|
-
addListener(event: "message", listener: (msg:
|
|
560
|
+
addListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
|
|
560
561
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
561
562
|
emit(event: "close"): boolean;
|
|
562
563
|
emit(event: "connect"): boolean;
|
|
563
564
|
emit(event: "error", err: Error): boolean;
|
|
564
565
|
emit(event: "listening"): boolean;
|
|
565
|
-
emit(event: "message", msg:
|
|
566
|
+
emit(event: "message", msg: NonSharedBuffer, rinfo: RemoteInfo): boolean;
|
|
566
567
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
567
568
|
on(event: "close", listener: () => void): this;
|
|
568
569
|
on(event: "connect", listener: () => void): this;
|
|
569
570
|
on(event: "error", listener: (err: Error) => void): this;
|
|
570
571
|
on(event: "listening", listener: () => void): this;
|
|
571
|
-
on(event: "message", listener: (msg:
|
|
572
|
+
on(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
|
|
572
573
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
573
574
|
once(event: "close", listener: () => void): this;
|
|
574
575
|
once(event: "connect", listener: () => void): this;
|
|
575
576
|
once(event: "error", listener: (err: Error) => void): this;
|
|
576
577
|
once(event: "listening", listener: () => void): this;
|
|
577
|
-
once(event: "message", listener: (msg:
|
|
578
|
+
once(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
|
|
578
579
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
579
580
|
prependListener(event: "close", listener: () => void): this;
|
|
580
581
|
prependListener(event: "connect", listener: () => void): this;
|
|
581
582
|
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
582
583
|
prependListener(event: "listening", listener: () => void): this;
|
|
583
|
-
prependListener(event: "message", listener: (msg:
|
|
584
|
+
prependListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
|
|
584
585
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
585
586
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
586
587
|
prependOnceListener(event: "connect", listener: () => void): this;
|
|
587
588
|
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
588
589
|
prependOnceListener(event: "listening", listener: () => void): this;
|
|
589
|
-
prependOnceListener(event: "message", listener: (msg:
|
|
590
|
+
prependOnceListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
|
|
590
591
|
/**
|
|
591
592
|
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
|
|
592
593
|
* @since v20.5.0
|
node/fs/promises.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @since v10.0.0
|
|
10
10
|
*/
|
|
11
11
|
declare module "fs/promises" {
|
|
12
|
+
import { NonSharedBuffer } from "node:buffer";
|
|
12
13
|
import { Abortable } from "node:events";
|
|
13
14
|
import { Stream } from "node:stream";
|
|
14
15
|
import { ReadableStream } from "node:stream/web";
|
|
@@ -31,6 +32,8 @@ declare module "fs/promises" {
|
|
|
31
32
|
OpenDirOptions,
|
|
32
33
|
OpenMode,
|
|
33
34
|
PathLike,
|
|
35
|
+
ReadOptions,
|
|
36
|
+
ReadOptionsWithBuffer,
|
|
34
37
|
ReadPosition,
|
|
35
38
|
ReadStream,
|
|
36
39
|
ReadVResult,
|
|
@@ -59,6 +62,7 @@ declare module "fs/promises" {
|
|
|
59
62
|
bytesRead: number;
|
|
60
63
|
buffer: T;
|
|
61
64
|
}
|
|
65
|
+
/** @deprecated This interface will be removed in a future version. Use `import { ReadOptionsWithBuffer } from "node:fs"` instead. */
|
|
62
66
|
interface FileReadOptions<T extends NodeJS.ArrayBufferView = Buffer> {
|
|
63
67
|
/**
|
|
64
68
|
* @default `Buffer.alloc(0xffff)`
|
|
@@ -237,11 +241,13 @@ declare module "fs/promises" {
|
|
|
237
241
|
length?: number | null,
|
|
238
242
|
position?: ReadPosition | null,
|
|
239
243
|
): Promise<FileReadResult<T>>;
|
|
240
|
-
read<T extends NodeJS.ArrayBufferView
|
|
244
|
+
read<T extends NodeJS.ArrayBufferView>(
|
|
241
245
|
buffer: T,
|
|
242
|
-
options?:
|
|
246
|
+
options?: ReadOptions,
|
|
247
|
+
): Promise<FileReadResult<T>>;
|
|
248
|
+
read<T extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
249
|
+
options?: ReadOptionsWithBuffer<T>,
|
|
243
250
|
): Promise<FileReadResult<T>>;
|
|
244
|
-
read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
|
|
245
251
|
/**
|
|
246
252
|
* Returns a byte-oriented `ReadableStream` that may be used to read the file's
|
|
247
253
|
* contents.
|
|
@@ -285,7 +291,7 @@ declare module "fs/promises" {
|
|
|
285
291
|
options?:
|
|
286
292
|
| ({ encoding?: null | undefined } & Abortable)
|
|
287
293
|
| null,
|
|
288
|
-
): Promise<
|
|
294
|
+
): Promise<NonSharedBuffer>;
|
|
289
295
|
/**
|
|
290
296
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
291
297
|
* The `FileHandle` must have been opened for reading.
|
|
@@ -304,7 +310,7 @@ declare module "fs/promises" {
|
|
|
304
310
|
| (ObjectEncodingOptions & Abortable)
|
|
305
311
|
| BufferEncoding
|
|
306
312
|
| null,
|
|
307
|
-
): Promise<string |
|
|
313
|
+
): Promise<string | NonSharedBuffer>;
|
|
308
314
|
/**
|
|
309
315
|
* Convenience method to create a `readline` interface and stream over the file.
|
|
310
316
|
* See `filehandle.createReadStream()` for the options.
|
|
@@ -413,7 +419,7 @@ declare module "fs/promises" {
|
|
|
413
419
|
* @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current
|
|
414
420
|
* position. See the POSIX pwrite(2) documentation for more detail.
|
|
415
421
|
*/
|
|
416
|
-
write<TBuffer extends
|
|
422
|
+
write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
417
423
|
buffer: TBuffer,
|
|
418
424
|
offset?: number | null,
|
|
419
425
|
length?: number | null,
|
|
@@ -452,14 +458,20 @@ declare module "fs/promises" {
|
|
|
452
458
|
* @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current
|
|
453
459
|
* position.
|
|
454
460
|
*/
|
|
455
|
-
writev
|
|
461
|
+
writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
462
|
+
buffers: TBuffers,
|
|
463
|
+
position?: number,
|
|
464
|
+
): Promise<WriteVResult<TBuffers>>;
|
|
456
465
|
/**
|
|
457
466
|
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
|
|
458
467
|
* @since v13.13.0, v12.17.0
|
|
459
468
|
* @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
|
|
460
469
|
* @return Fulfills upon success an object containing two properties:
|
|
461
470
|
*/
|
|
462
|
-
readv
|
|
471
|
+
readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
472
|
+
buffers: TBuffers,
|
|
473
|
+
position?: number,
|
|
474
|
+
): Promise<ReadVResult<TBuffers>>;
|
|
463
475
|
/**
|
|
464
476
|
* Closes the file handle after waiting for any pending operation on the handle to
|
|
465
477
|
* complete.
|
|
@@ -696,7 +708,7 @@ declare module "fs/promises" {
|
|
|
696
708
|
recursive?: boolean | undefined;
|
|
697
709
|
}
|
|
698
710
|
| "buffer",
|
|
699
|
-
): Promise<
|
|
711
|
+
): Promise<NonSharedBuffer[]>;
|
|
700
712
|
/**
|
|
701
713
|
* Asynchronous readdir(3) - read a directory.
|
|
702
714
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -711,7 +723,7 @@ declare module "fs/promises" {
|
|
|
711
723
|
})
|
|
712
724
|
| BufferEncoding
|
|
713
725
|
| null,
|
|
714
|
-
): Promise<string[] |
|
|
726
|
+
): Promise<string[] | NonSharedBuffer[]>;
|
|
715
727
|
/**
|
|
716
728
|
* Asynchronous readdir(3) - read a directory.
|
|
717
729
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -736,7 +748,7 @@ declare module "fs/promises" {
|
|
|
736
748
|
withFileTypes: true;
|
|
737
749
|
recursive?: boolean | undefined;
|
|
738
750
|
},
|
|
739
|
-
): Promise<Dirent<
|
|
751
|
+
): Promise<Dirent<NonSharedBuffer>[]>;
|
|
740
752
|
/**
|
|
741
753
|
* Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is
|
|
742
754
|
* fulfilled with the`linkString` upon success.
|
|
@@ -754,13 +766,16 @@ declare module "fs/promises" {
|
|
|
754
766
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
755
767
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
756
768
|
*/
|
|
757
|
-
function readlink(path: PathLike, options: BufferEncodingOption): Promise<
|
|
769
|
+
function readlink(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
758
770
|
/**
|
|
759
771
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
760
772
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
761
773
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
762
774
|
*/
|
|
763
|
-
function readlink(
|
|
775
|
+
function readlink(
|
|
776
|
+
path: PathLike,
|
|
777
|
+
options?: ObjectEncodingOptions | string | null,
|
|
778
|
+
): Promise<string | NonSharedBuffer>;
|
|
764
779
|
/**
|
|
765
780
|
* Creates a symbolic link.
|
|
766
781
|
*
|
|
@@ -911,7 +926,7 @@ declare module "fs/promises" {
|
|
|
911
926
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
912
927
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
913
928
|
*/
|
|
914
|
-
function realpath(path: PathLike, options: BufferEncodingOption): Promise<
|
|
929
|
+
function realpath(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
915
930
|
/**
|
|
916
931
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
917
932
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -920,7 +935,7 @@ declare module "fs/promises" {
|
|
|
920
935
|
function realpath(
|
|
921
936
|
path: PathLike,
|
|
922
937
|
options?: ObjectEncodingOptions | BufferEncoding | null,
|
|
923
|
-
): Promise<string |
|
|
938
|
+
): Promise<string | NonSharedBuffer>;
|
|
924
939
|
/**
|
|
925
940
|
* Creates a unique temporary directory. A unique directory name is generated by
|
|
926
941
|
* appending six random characters to the end of the provided `prefix`. Due to
|
|
@@ -956,13 +971,16 @@ declare module "fs/promises" {
|
|
|
956
971
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
957
972
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
958
973
|
*/
|
|
959
|
-
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<
|
|
974
|
+
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
960
975
|
/**
|
|
961
976
|
* Asynchronously creates a unique temporary directory.
|
|
962
977
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
963
978
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
964
979
|
*/
|
|
965
|
-
function mkdtemp(
|
|
980
|
+
function mkdtemp(
|
|
981
|
+
prefix: string,
|
|
982
|
+
options?: ObjectEncodingOptions | BufferEncoding | null,
|
|
983
|
+
): Promise<string | NonSharedBuffer>;
|
|
966
984
|
/**
|
|
967
985
|
* The resulting Promise holds an async-disposable object whose `path` property
|
|
968
986
|
* holds the created directory path. When the object is disposed, the directory
|
|
@@ -1138,7 +1156,7 @@ declare module "fs/promises" {
|
|
|
1138
1156
|
flag?: OpenMode | undefined;
|
|
1139
1157
|
} & Abortable)
|
|
1140
1158
|
| null,
|
|
1141
|
-
): Promise<
|
|
1159
|
+
): Promise<NonSharedBuffer>;
|
|
1142
1160
|
/**
|
|
1143
1161
|
* Asynchronously reads the entire contents of a file.
|
|
1144
1162
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1174,7 +1192,7 @@ declare module "fs/promises" {
|
|
|
1174
1192
|
)
|
|
1175
1193
|
| BufferEncoding
|
|
1176
1194
|
| null,
|
|
1177
|
-
): Promise<string |
|
|
1195
|
+
): Promise<string | NonSharedBuffer>;
|
|
1178
1196
|
/**
|
|
1179
1197
|
* Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
|
|
1180
1198
|
*
|
|
@@ -1251,11 +1269,11 @@ declare module "fs/promises" {
|
|
|
1251
1269
|
function watch(
|
|
1252
1270
|
filename: PathLike,
|
|
1253
1271
|
options: WatchOptionsWithBufferEncoding | "buffer",
|
|
1254
|
-
): NodeJS.AsyncIterator<FileChangeInfo<
|
|
1272
|
+
): NodeJS.AsyncIterator<FileChangeInfo<NonSharedBuffer>>;
|
|
1255
1273
|
function watch(
|
|
1256
1274
|
filename: PathLike,
|
|
1257
1275
|
options: WatchOptions | BufferEncoding | "buffer",
|
|
1258
|
-
): NodeJS.AsyncIterator<FileChangeInfo<string |
|
|
1276
|
+
): NodeJS.AsyncIterator<FileChangeInfo<string | NonSharedBuffer>>;
|
|
1259
1277
|
/**
|
|
1260
1278
|
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
|
1261
1279
|
* including subdirectories and files.
|