@types/node 22.18.11 → 22.18.13
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 v22.18/README.md +1 -1
- node v22.18/buffer.buffer.d.ts +9 -0
- node v22.18/buffer.d.ts +8 -4
- node v22.18/child_process.d.ts +50 -33
- node v22.18/crypto.d.ts +151 -131
- node v22.18/dgram.d.ts +9 -8
- node v22.18/fs/promises.d.ts +39 -21
- node v22.18/fs.d.ts +89 -76
- node v22.18/globals.typedarray.d.ts +17 -0
- node v22.18/http.d.ts +41 -22
- node v22.18/http2.d.ts +29 -22
- node v22.18/https.d.ts +82 -50
- node v22.18/net.d.ts +7 -6
- node v22.18/os.d.ts +2 -1
- node v22.18/package.json +2 -2
- node v22.18/process.d.ts +6 -5
- node v22.18/sqlite.d.ts +6 -7
- node v22.18/stream/consumers.d.ts +2 -2
- node v22.18/string_decoder.d.ts +2 -2
- node v22.18/tls.d.ts +88 -64
- node v22.18/ts5.6/buffer.buffer.d.ts +10 -2
- node v22.18/ts5.6/globals.typedarray.d.ts +15 -0
- node v22.18/url.d.ts +2 -2
- node v22.18/util.d.ts +1 -1
- node v22.18/v8.d.ts +4 -3
- node v22.18/vm.d.ts +4 -3
- node v22.18/zlib.d.ts +25 -24
node v22.18/fs.d.ts
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/fs.js)
|
|
20
20
|
*/
|
|
21
21
|
declare module "fs" {
|
|
22
|
+
import { NonSharedBuffer } from "node:buffer";
|
|
22
23
|
import * as stream from "node:stream";
|
|
23
24
|
import { Abortable, EventEmitter } from "node:events";
|
|
24
25
|
import { URL } from "node:url";
|
|
@@ -402,23 +403,29 @@ declare module "fs" {
|
|
|
402
403
|
* 3. error
|
|
403
404
|
*/
|
|
404
405
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
405
|
-
addListener(event: "change", listener: (eventType: string, filename: string |
|
|
406
|
+
addListener(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
406
407
|
addListener(event: "close", listener: () => void): this;
|
|
407
408
|
addListener(event: "error", listener: (error: Error) => void): this;
|
|
408
409
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
409
|
-
on(event: "change", listener: (eventType: string, filename: string |
|
|
410
|
+
on(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
410
411
|
on(event: "close", listener: () => void): this;
|
|
411
412
|
on(event: "error", listener: (error: Error) => void): this;
|
|
412
413
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
413
|
-
once(event: "change", listener: (eventType: string, filename: string |
|
|
414
|
+
once(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
414
415
|
once(event: "close", listener: () => void): this;
|
|
415
416
|
once(event: "error", listener: (error: Error) => void): this;
|
|
416
417
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
417
|
-
prependListener(
|
|
418
|
+
prependListener(
|
|
419
|
+
event: "change",
|
|
420
|
+
listener: (eventType: string, filename: string | NonSharedBuffer) => void,
|
|
421
|
+
): this;
|
|
418
422
|
prependListener(event: "close", listener: () => void): this;
|
|
419
423
|
prependListener(event: "error", listener: (error: Error) => void): this;
|
|
420
424
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
421
|
-
prependOnceListener(
|
|
425
|
+
prependOnceListener(
|
|
426
|
+
event: "change",
|
|
427
|
+
listener: (eventType: string, filename: string | NonSharedBuffer) => void,
|
|
428
|
+
): this;
|
|
422
429
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
423
430
|
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
|
424
431
|
}
|
|
@@ -1334,7 +1341,7 @@ declare module "fs" {
|
|
|
1334
1341
|
export function readlink(
|
|
1335
1342
|
path: PathLike,
|
|
1336
1343
|
options: BufferEncodingOption,
|
|
1337
|
-
callback: (err: NodeJS.ErrnoException | null, linkString:
|
|
1344
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void,
|
|
1338
1345
|
): void;
|
|
1339
1346
|
/**
|
|
1340
1347
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -1344,7 +1351,7 @@ declare module "fs" {
|
|
|
1344
1351
|
export function readlink(
|
|
1345
1352
|
path: PathLike,
|
|
1346
1353
|
options: EncodingOption,
|
|
1347
|
-
callback: (err: NodeJS.ErrnoException | null, linkString: string |
|
|
1354
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void,
|
|
1348
1355
|
): void;
|
|
1349
1356
|
/**
|
|
1350
1357
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -1366,13 +1373,13 @@ declare module "fs" {
|
|
|
1366
1373
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1367
1374
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1368
1375
|
*/
|
|
1369
|
-
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<
|
|
1376
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1370
1377
|
/**
|
|
1371
1378
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
1372
1379
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1373
1380
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1374
1381
|
*/
|
|
1375
|
-
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string |
|
|
1382
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1376
1383
|
}
|
|
1377
1384
|
/**
|
|
1378
1385
|
* Returns the symbolic link's string value.
|
|
@@ -1391,13 +1398,13 @@ declare module "fs" {
|
|
|
1391
1398
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1392
1399
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1393
1400
|
*/
|
|
1394
|
-
export function readlinkSync(path: PathLike, options: BufferEncodingOption):
|
|
1401
|
+
export function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1395
1402
|
/**
|
|
1396
1403
|
* Synchronous readlink(2) - read value of a symbolic link.
|
|
1397
1404
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1398
1405
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1399
1406
|
*/
|
|
1400
|
-
export function readlinkSync(path: PathLike, options?: EncodingOption): string |
|
|
1407
|
+
export function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1401
1408
|
/**
|
|
1402
1409
|
* Asynchronously computes the canonical pathname by resolving `.`, `..`, and
|
|
1403
1410
|
* symbolic links.
|
|
@@ -1437,7 +1444,7 @@ declare module "fs" {
|
|
|
1437
1444
|
export function realpath(
|
|
1438
1445
|
path: PathLike,
|
|
1439
1446
|
options: BufferEncodingOption,
|
|
1440
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath:
|
|
1447
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
|
|
1441
1448
|
): void;
|
|
1442
1449
|
/**
|
|
1443
1450
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -1447,7 +1454,7 @@ declare module "fs" {
|
|
|
1447
1454
|
export function realpath(
|
|
1448
1455
|
path: PathLike,
|
|
1449
1456
|
options: EncodingOption,
|
|
1450
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string |
|
|
1457
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
|
|
1451
1458
|
): void;
|
|
1452
1459
|
/**
|
|
1453
1460
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -1469,13 +1476,13 @@ declare module "fs" {
|
|
|
1469
1476
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1470
1477
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1471
1478
|
*/
|
|
1472
|
-
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<
|
|
1479
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1473
1480
|
/**
|
|
1474
1481
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1475
1482
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1476
1483
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1477
1484
|
*/
|
|
1478
|
-
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string |
|
|
1485
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1479
1486
|
/**
|
|
1480
1487
|
* Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html).
|
|
1481
1488
|
*
|
|
@@ -1501,12 +1508,12 @@ declare module "fs" {
|
|
|
1501
1508
|
function native(
|
|
1502
1509
|
path: PathLike,
|
|
1503
1510
|
options: BufferEncodingOption,
|
|
1504
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath:
|
|
1511
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
|
|
1505
1512
|
): void;
|
|
1506
1513
|
function native(
|
|
1507
1514
|
path: PathLike,
|
|
1508
1515
|
options: EncodingOption,
|
|
1509
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string |
|
|
1516
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
|
|
1510
1517
|
): void;
|
|
1511
1518
|
function native(
|
|
1512
1519
|
path: PathLike,
|
|
@@ -1526,17 +1533,17 @@ declare module "fs" {
|
|
|
1526
1533
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1527
1534
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1528
1535
|
*/
|
|
1529
|
-
export function realpathSync(path: PathLike, options: BufferEncodingOption):
|
|
1536
|
+
export function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1530
1537
|
/**
|
|
1531
1538
|
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1532
1539
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1533
1540
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1534
1541
|
*/
|
|
1535
|
-
export function realpathSync(path: PathLike, options?: EncodingOption): string |
|
|
1542
|
+
export function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1536
1543
|
export namespace realpathSync {
|
|
1537
1544
|
function native(path: PathLike, options?: EncodingOption): string;
|
|
1538
|
-
function native(path: PathLike, options: BufferEncodingOption):
|
|
1539
|
-
function native(path: PathLike, options?: EncodingOption): string |
|
|
1545
|
+
function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1546
|
+
function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1540
1547
|
}
|
|
1541
1548
|
/**
|
|
1542
1549
|
* Asynchronously removes a file or symbolic link. No arguments other than a
|
|
@@ -1906,12 +1913,8 @@ declare module "fs" {
|
|
|
1906
1913
|
*/
|
|
1907
1914
|
export function mkdtemp(
|
|
1908
1915
|
prefix: string,
|
|
1909
|
-
options:
|
|
1910
|
-
|
|
1911
|
-
| {
|
|
1912
|
-
encoding: "buffer";
|
|
1913
|
-
},
|
|
1914
|
-
callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void,
|
|
1916
|
+
options: BufferEncodingOption,
|
|
1917
|
+
callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void,
|
|
1915
1918
|
): void;
|
|
1916
1919
|
/**
|
|
1917
1920
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -1921,7 +1924,7 @@ declare module "fs" {
|
|
|
1921
1924
|
export function mkdtemp(
|
|
1922
1925
|
prefix: string,
|
|
1923
1926
|
options: EncodingOption,
|
|
1924
|
-
callback: (err: NodeJS.ErrnoException | null, folder: string |
|
|
1927
|
+
callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void,
|
|
1925
1928
|
): void;
|
|
1926
1929
|
/**
|
|
1927
1930
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -1943,13 +1946,13 @@ declare module "fs" {
|
|
|
1943
1946
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1944
1947
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1945
1948
|
*/
|
|
1946
|
-
function __promisify__(prefix: string, options: BufferEncodingOption): Promise<
|
|
1949
|
+
function __promisify__(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1947
1950
|
/**
|
|
1948
1951
|
* Asynchronously creates a unique temporary directory.
|
|
1949
1952
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1950
1953
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1951
1954
|
*/
|
|
1952
|
-
function __promisify__(prefix: string, options?: EncodingOption): Promise<string |
|
|
1955
|
+
function __promisify__(prefix: string, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1953
1956
|
}
|
|
1954
1957
|
/**
|
|
1955
1958
|
* Returns the created directory path.
|
|
@@ -1967,13 +1970,13 @@ declare module "fs" {
|
|
|
1967
1970
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1968
1971
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1969
1972
|
*/
|
|
1970
|
-
export function mkdtempSync(prefix: string, options: BufferEncodingOption):
|
|
1973
|
+
export function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
|
|
1971
1974
|
/**
|
|
1972
1975
|
* Synchronously creates a unique temporary directory.
|
|
1973
1976
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1974
1977
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1975
1978
|
*/
|
|
1976
|
-
export function mkdtempSync(prefix: string, options?: EncodingOption): string |
|
|
1979
|
+
export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
|
|
1977
1980
|
/**
|
|
1978
1981
|
* Reads the contents of a directory. The callback gets two arguments `(err, files)` where `files` is an array of the names of the files in the directory excluding `'.'` and `'..'`.
|
|
1979
1982
|
*
|
|
@@ -2014,7 +2017,7 @@ declare module "fs" {
|
|
|
2014
2017
|
recursive?: boolean | undefined;
|
|
2015
2018
|
}
|
|
2016
2019
|
| "buffer",
|
|
2017
|
-
callback: (err: NodeJS.ErrnoException | null, files:
|
|
2020
|
+
callback: (err: NodeJS.ErrnoException | null, files: NonSharedBuffer[]) => void,
|
|
2018
2021
|
): void;
|
|
2019
2022
|
/**
|
|
2020
2023
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -2031,7 +2034,7 @@ declare module "fs" {
|
|
|
2031
2034
|
| BufferEncoding
|
|
2032
2035
|
| undefined
|
|
2033
2036
|
| null,
|
|
2034
|
-
callback: (err: NodeJS.ErrnoException | null, files: string[] |
|
|
2037
|
+
callback: (err: NodeJS.ErrnoException | null, files: string[] | NonSharedBuffer[]) => void,
|
|
2035
2038
|
): void;
|
|
2036
2039
|
/**
|
|
2037
2040
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -2066,7 +2069,7 @@ declare module "fs" {
|
|
|
2066
2069
|
withFileTypes: true;
|
|
2067
2070
|
recursive?: boolean | undefined;
|
|
2068
2071
|
},
|
|
2069
|
-
callback: (err: NodeJS.ErrnoException | null, files: Dirent<
|
|
2072
|
+
callback: (err: NodeJS.ErrnoException | null, files: Dirent<NonSharedBuffer>[]) => void,
|
|
2070
2073
|
): void;
|
|
2071
2074
|
export namespace readdir {
|
|
2072
2075
|
/**
|
|
@@ -2099,7 +2102,7 @@ declare module "fs" {
|
|
|
2099
2102
|
withFileTypes?: false | undefined;
|
|
2100
2103
|
recursive?: boolean | undefined;
|
|
2101
2104
|
},
|
|
2102
|
-
): Promise<
|
|
2105
|
+
): Promise<NonSharedBuffer[]>;
|
|
2103
2106
|
/**
|
|
2104
2107
|
* Asynchronous readdir(3) - read a directory.
|
|
2105
2108
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2114,7 +2117,7 @@ declare module "fs" {
|
|
|
2114
2117
|
})
|
|
2115
2118
|
| BufferEncoding
|
|
2116
2119
|
| null,
|
|
2117
|
-
): Promise<string[] |
|
|
2120
|
+
): Promise<string[] | NonSharedBuffer[]>;
|
|
2118
2121
|
/**
|
|
2119
2122
|
* Asynchronous readdir(3) - read a directory.
|
|
2120
2123
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2139,7 +2142,7 @@ declare module "fs" {
|
|
|
2139
2142
|
withFileTypes: true;
|
|
2140
2143
|
recursive?: boolean | undefined;
|
|
2141
2144
|
},
|
|
2142
|
-
): Promise<Dirent<
|
|
2145
|
+
): Promise<Dirent<NonSharedBuffer>[]>;
|
|
2143
2146
|
}
|
|
2144
2147
|
/**
|
|
2145
2148
|
* Reads the contents of the directory.
|
|
@@ -2179,7 +2182,7 @@ declare module "fs" {
|
|
|
2179
2182
|
recursive?: boolean | undefined;
|
|
2180
2183
|
}
|
|
2181
2184
|
| "buffer",
|
|
2182
|
-
):
|
|
2185
|
+
): NonSharedBuffer[];
|
|
2183
2186
|
/**
|
|
2184
2187
|
* Synchronous readdir(3) - read a directory.
|
|
2185
2188
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2194,7 +2197,7 @@ declare module "fs" {
|
|
|
2194
2197
|
})
|
|
2195
2198
|
| BufferEncoding
|
|
2196
2199
|
| null,
|
|
2197
|
-
): string[] |
|
|
2200
|
+
): string[] | NonSharedBuffer[];
|
|
2198
2201
|
/**
|
|
2199
2202
|
* Synchronous readdir(3) - read a directory.
|
|
2200
2203
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2219,7 +2222,7 @@ declare module "fs" {
|
|
|
2219
2222
|
withFileTypes: true;
|
|
2220
2223
|
recursive?: boolean | undefined;
|
|
2221
2224
|
},
|
|
2222
|
-
): Dirent<
|
|
2225
|
+
): Dirent<NonSharedBuffer>[];
|
|
2223
2226
|
/**
|
|
2224
2227
|
* Closes the file descriptor. No arguments other than a possible exception are
|
|
2225
2228
|
* given to the completion callback.
|
|
@@ -2586,7 +2589,7 @@ declare module "fs" {
|
|
|
2586
2589
|
encoding?: BufferEncoding | null,
|
|
2587
2590
|
): number;
|
|
2588
2591
|
export type ReadPosition = number | bigint;
|
|
2589
|
-
export interface
|
|
2592
|
+
export interface ReadOptions {
|
|
2590
2593
|
/**
|
|
2591
2594
|
* @default 0
|
|
2592
2595
|
*/
|
|
@@ -2600,9 +2603,15 @@ declare module "fs" {
|
|
|
2600
2603
|
*/
|
|
2601
2604
|
position?: ReadPosition | null | undefined;
|
|
2602
2605
|
}
|
|
2603
|
-
export interface
|
|
2604
|
-
buffer?:
|
|
2606
|
+
export interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
|
|
2607
|
+
buffer?: T | undefined;
|
|
2605
2608
|
}
|
|
2609
|
+
/** @deprecated Use `ReadOptions` instead. */
|
|
2610
|
+
// TODO: remove in future major
|
|
2611
|
+
export interface ReadSyncOptions extends ReadOptions {}
|
|
2612
|
+
/** @deprecated Use `ReadOptionsWithBuffer` instead. */
|
|
2613
|
+
// TODO: remove in future major
|
|
2614
|
+
export interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
|
|
2606
2615
|
/**
|
|
2607
2616
|
* Read data from the file specified by `fd`.
|
|
2608
2617
|
*
|
|
@@ -2637,15 +2646,15 @@ declare module "fs" {
|
|
|
2637
2646
|
* `position` defaults to `null`
|
|
2638
2647
|
* @since v12.17.0, 13.11.0
|
|
2639
2648
|
*/
|
|
2640
|
-
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2649
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
2641
2650
|
fd: number,
|
|
2642
|
-
options:
|
|
2651
|
+
options: ReadOptionsWithBuffer<TBuffer>,
|
|
2643
2652
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2644
2653
|
): void;
|
|
2645
2654
|
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2646
2655
|
fd: number,
|
|
2647
2656
|
buffer: TBuffer,
|
|
2648
|
-
options:
|
|
2657
|
+
options: ReadOptions,
|
|
2649
2658
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2650
2659
|
): void;
|
|
2651
2660
|
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
@@ -2655,7 +2664,7 @@ declare module "fs" {
|
|
|
2655
2664
|
): void;
|
|
2656
2665
|
export function read(
|
|
2657
2666
|
fd: number,
|
|
2658
|
-
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer:
|
|
2667
|
+
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void,
|
|
2659
2668
|
): void;
|
|
2660
2669
|
export namespace read {
|
|
2661
2670
|
/**
|
|
@@ -2675,16 +2684,16 @@ declare module "fs" {
|
|
|
2675
2684
|
bytesRead: number;
|
|
2676
2685
|
buffer: TBuffer;
|
|
2677
2686
|
}>;
|
|
2678
|
-
function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2687
|
+
function __promisify__<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
2679
2688
|
fd: number,
|
|
2680
|
-
options:
|
|
2689
|
+
options: ReadOptionsWithBuffer<TBuffer>,
|
|
2681
2690
|
): Promise<{
|
|
2682
2691
|
bytesRead: number;
|
|
2683
2692
|
buffer: TBuffer;
|
|
2684
2693
|
}>;
|
|
2685
2694
|
function __promisify__(fd: number): Promise<{
|
|
2686
2695
|
bytesRead: number;
|
|
2687
|
-
buffer:
|
|
2696
|
+
buffer: NonSharedBuffer;
|
|
2688
2697
|
}>;
|
|
2689
2698
|
}
|
|
2690
2699
|
/**
|
|
@@ -2706,7 +2715,7 @@ declare module "fs" {
|
|
|
2706
2715
|
* Similar to the above `fs.readSync` function, this version takes an optional `options` object.
|
|
2707
2716
|
* If no `options` object is specified, it will default with the above values.
|
|
2708
2717
|
*/
|
|
2709
|
-
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?:
|
|
2718
|
+
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
|
|
2710
2719
|
/**
|
|
2711
2720
|
* Asynchronously reads the entire contents of a file.
|
|
2712
2721
|
*
|
|
@@ -3379,12 +3388,12 @@ declare module "fs" {
|
|
|
3379
3388
|
export function watch(
|
|
3380
3389
|
filename: PathLike,
|
|
3381
3390
|
options: WatchOptionsWithBufferEncoding | "buffer",
|
|
3382
|
-
listener: WatchListener<
|
|
3391
|
+
listener: WatchListener<NonSharedBuffer>,
|
|
3383
3392
|
): FSWatcher;
|
|
3384
3393
|
export function watch(
|
|
3385
3394
|
filename: PathLike,
|
|
3386
3395
|
options: WatchOptions | BufferEncoding | "buffer" | null,
|
|
3387
|
-
listener: WatchListener<string |
|
|
3396
|
+
listener: WatchListener<string | NonSharedBuffer>,
|
|
3388
3397
|
): FSWatcher;
|
|
3389
3398
|
export function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
|
|
3390
3399
|
/**
|
|
@@ -4095,27 +4104,29 @@ declare module "fs" {
|
|
|
4095
4104
|
* @since v12.9.0
|
|
4096
4105
|
* @param [position='null']
|
|
4097
4106
|
*/
|
|
4098
|
-
export function writev(
|
|
4107
|
+
export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4099
4108
|
fd: number,
|
|
4100
|
-
buffers:
|
|
4101
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers:
|
|
4109
|
+
buffers: TBuffers,
|
|
4110
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
|
|
4102
4111
|
): void;
|
|
4103
|
-
export function writev(
|
|
4112
|
+
export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4104
4113
|
fd: number,
|
|
4105
|
-
buffers:
|
|
4114
|
+
buffers: TBuffers,
|
|
4106
4115
|
position: number | null,
|
|
4107
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers:
|
|
4116
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
|
|
4108
4117
|
): void;
|
|
4109
|
-
|
|
4118
|
+
// Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
|
|
4119
|
+
// TODO: remove default in future major version
|
|
4120
|
+
export interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
|
|
4110
4121
|
bytesWritten: number;
|
|
4111
|
-
buffers:
|
|
4122
|
+
buffers: T;
|
|
4112
4123
|
}
|
|
4113
4124
|
export namespace writev {
|
|
4114
|
-
function __promisify__(
|
|
4125
|
+
function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4115
4126
|
fd: number,
|
|
4116
|
-
buffers:
|
|
4127
|
+
buffers: TBuffers,
|
|
4117
4128
|
position?: number,
|
|
4118
|
-
): Promise<WriteVResult
|
|
4129
|
+
): Promise<WriteVResult<TBuffers>>;
|
|
4119
4130
|
}
|
|
4120
4131
|
/**
|
|
4121
4132
|
* For detailed information, see the documentation of the asynchronous version of
|
|
@@ -4140,27 +4151,29 @@ declare module "fs" {
|
|
|
4140
4151
|
* @since v13.13.0, v12.17.0
|
|
4141
4152
|
* @param [position='null']
|
|
4142
4153
|
*/
|
|
4143
|
-
export function readv(
|
|
4154
|
+
export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4144
4155
|
fd: number,
|
|
4145
|
-
buffers:
|
|
4146
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers:
|
|
4156
|
+
buffers: TBuffers,
|
|
4157
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
|
|
4147
4158
|
): void;
|
|
4148
|
-
export function readv(
|
|
4159
|
+
export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4149
4160
|
fd: number,
|
|
4150
|
-
buffers:
|
|
4161
|
+
buffers: TBuffers,
|
|
4151
4162
|
position: number | null,
|
|
4152
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers:
|
|
4163
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
|
|
4153
4164
|
): void;
|
|
4154
|
-
|
|
4165
|
+
// Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
|
|
4166
|
+
// TODO: remove default in future major version
|
|
4167
|
+
export interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
|
|
4155
4168
|
bytesRead: number;
|
|
4156
|
-
buffers:
|
|
4169
|
+
buffers: T;
|
|
4157
4170
|
}
|
|
4158
4171
|
export namespace readv {
|
|
4159
|
-
function __promisify__(
|
|
4172
|
+
function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4160
4173
|
fd: number,
|
|
4161
|
-
buffers:
|
|
4174
|
+
buffers: TBuffers,
|
|
4162
4175
|
position?: number,
|
|
4163
|
-
): Promise<ReadVResult
|
|
4176
|
+
): Promise<ReadVResult<TBuffers>>;
|
|
4164
4177
|
}
|
|
4165
4178
|
/**
|
|
4166
4179
|
* For detailed information, see the documentation of the asynchronous version of
|
|
@@ -17,5 +17,22 @@ declare global {
|
|
|
17
17
|
type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
|
|
18
18
|
| TypedArray<TArrayBuffer>
|
|
19
19
|
| DataView<TArrayBuffer>;
|
|
20
|
+
|
|
21
|
+
// The following aliases are required to allow use of non-shared ArrayBufferViews in @types/node
|
|
22
|
+
// while maintaining compatibility with TS <=5.6.
|
|
23
|
+
type NonSharedUint8Array = Uint8Array<ArrayBuffer>;
|
|
24
|
+
type NonSharedUint8ClampedArray = Uint8ClampedArray<ArrayBuffer>;
|
|
25
|
+
type NonSharedUint16Array = Uint16Array<ArrayBuffer>;
|
|
26
|
+
type NonSharedUint32Array = Uint32Array<ArrayBuffer>;
|
|
27
|
+
type NonSharedInt8Array = Int8Array<ArrayBuffer>;
|
|
28
|
+
type NonSharedInt16Array = Int16Array<ArrayBuffer>;
|
|
29
|
+
type NonSharedInt32Array = Int32Array<ArrayBuffer>;
|
|
30
|
+
type NonSharedBigUint64Array = BigUint64Array<ArrayBuffer>;
|
|
31
|
+
type NonSharedBigInt64Array = BigInt64Array<ArrayBuffer>;
|
|
32
|
+
type NonSharedFloat32Array = Float32Array<ArrayBuffer>;
|
|
33
|
+
type NonSharedFloat64Array = Float64Array<ArrayBuffer>;
|
|
34
|
+
type NonSharedDataView = DataView<ArrayBuffer>;
|
|
35
|
+
type NonSharedTypedArray = TypedArray<ArrayBuffer>;
|
|
36
|
+
type NonSharedArrayBufferView = ArrayBufferView<ArrayBuffer>;
|
|
20
37
|
}
|
|
21
38
|
}
|