@types/node 20.19.22 → 20.19.24
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 v20.19/README.md +1 -1
- node v20.19/buffer.buffer.d.ts +9 -0
- node v20.19/buffer.d.ts +8 -4
- node v20.19/child_process.d.ts +50 -33
- node v20.19/crypto.d.ts +151 -131
- node v20.19/dgram.d.ts +9 -8
- node v20.19/fs/promises.d.ts +41 -19
- node v20.19/fs.d.ts +89 -76
- node v20.19/globals.typedarray.d.ts +17 -0
- node v20.19/http.d.ts +41 -22
- node v20.19/http2.d.ts +29 -22
- node v20.19/https.d.ts +82 -50
- node v20.19/net.d.ts +7 -6
- node v20.19/os.d.ts +3 -2
- node v20.19/package.json +2 -2
- node v20.19/process.d.ts +6 -5
- node v20.19/stream/consumers.d.ts +2 -2
- node v20.19/string_decoder.d.ts +2 -2
- node v20.19/tls.d.ts +88 -64
- node v20.19/ts5.6/buffer.buffer.d.ts +10 -2
- node v20.19/ts5.6/globals.typedarray.d.ts +15 -0
- node v20.19/url.d.ts +1 -1
- node v20.19/util.d.ts +1 -1
- node v20.19/v8.d.ts +4 -3
- node v20.19/vm.d.ts +4 -3
- node v20.19/zlib.d.ts +21 -20
node v20.19/fs.d.ts
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/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";
|
|
@@ -386,23 +387,29 @@ declare module "fs" {
|
|
|
386
387
|
* 3. error
|
|
387
388
|
*/
|
|
388
389
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
389
|
-
addListener(event: "change", listener: (eventType: string, filename: string |
|
|
390
|
+
addListener(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
390
391
|
addListener(event: "close", listener: () => void): this;
|
|
391
392
|
addListener(event: "error", listener: (error: Error) => void): this;
|
|
392
393
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
393
|
-
on(event: "change", listener: (eventType: string, filename: string |
|
|
394
|
+
on(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
394
395
|
on(event: "close", listener: () => void): this;
|
|
395
396
|
on(event: "error", listener: (error: Error) => void): this;
|
|
396
397
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
397
|
-
once(event: "change", listener: (eventType: string, filename: string |
|
|
398
|
+
once(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
398
399
|
once(event: "close", listener: () => void): this;
|
|
399
400
|
once(event: "error", listener: (error: Error) => void): this;
|
|
400
401
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
401
|
-
prependListener(
|
|
402
|
+
prependListener(
|
|
403
|
+
event: "change",
|
|
404
|
+
listener: (eventType: string, filename: string | NonSharedBuffer) => void,
|
|
405
|
+
): this;
|
|
402
406
|
prependListener(event: "close", listener: () => void): this;
|
|
403
407
|
prependListener(event: "error", listener: (error: Error) => void): this;
|
|
404
408
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
405
|
-
prependOnceListener(
|
|
409
|
+
prependOnceListener(
|
|
410
|
+
event: "change",
|
|
411
|
+
listener: (eventType: string, filename: string | NonSharedBuffer) => void,
|
|
412
|
+
): this;
|
|
406
413
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
407
414
|
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
|
408
415
|
}
|
|
@@ -1318,7 +1325,7 @@ declare module "fs" {
|
|
|
1318
1325
|
export function readlink(
|
|
1319
1326
|
path: PathLike,
|
|
1320
1327
|
options: BufferEncodingOption,
|
|
1321
|
-
callback: (err: NodeJS.ErrnoException | null, linkString:
|
|
1328
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void,
|
|
1322
1329
|
): void;
|
|
1323
1330
|
/**
|
|
1324
1331
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -1328,7 +1335,7 @@ declare module "fs" {
|
|
|
1328
1335
|
export function readlink(
|
|
1329
1336
|
path: PathLike,
|
|
1330
1337
|
options: EncodingOption,
|
|
1331
|
-
callback: (err: NodeJS.ErrnoException | null, linkString: string |
|
|
1338
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void,
|
|
1332
1339
|
): void;
|
|
1333
1340
|
/**
|
|
1334
1341
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -1350,13 +1357,13 @@ declare module "fs" {
|
|
|
1350
1357
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1351
1358
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1352
1359
|
*/
|
|
1353
|
-
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<
|
|
1360
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1354
1361
|
/**
|
|
1355
1362
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
1356
1363
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1357
1364
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1358
1365
|
*/
|
|
1359
|
-
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string |
|
|
1366
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1360
1367
|
}
|
|
1361
1368
|
/**
|
|
1362
1369
|
* Returns the symbolic link's string value.
|
|
@@ -1375,13 +1382,13 @@ declare module "fs" {
|
|
|
1375
1382
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1376
1383
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1377
1384
|
*/
|
|
1378
|
-
export function readlinkSync(path: PathLike, options: BufferEncodingOption):
|
|
1385
|
+
export function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1379
1386
|
/**
|
|
1380
1387
|
* Synchronous readlink(2) - read value of a symbolic link.
|
|
1381
1388
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1382
1389
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1383
1390
|
*/
|
|
1384
|
-
export function readlinkSync(path: PathLike, options?: EncodingOption): string |
|
|
1391
|
+
export function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1385
1392
|
/**
|
|
1386
1393
|
* Asynchronously computes the canonical pathname by resolving `.`, `..`, and
|
|
1387
1394
|
* symbolic links.
|
|
@@ -1421,7 +1428,7 @@ declare module "fs" {
|
|
|
1421
1428
|
export function realpath(
|
|
1422
1429
|
path: PathLike,
|
|
1423
1430
|
options: BufferEncodingOption,
|
|
1424
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath:
|
|
1431
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
|
|
1425
1432
|
): void;
|
|
1426
1433
|
/**
|
|
1427
1434
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -1431,7 +1438,7 @@ declare module "fs" {
|
|
|
1431
1438
|
export function realpath(
|
|
1432
1439
|
path: PathLike,
|
|
1433
1440
|
options: EncodingOption,
|
|
1434
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string |
|
|
1441
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
|
|
1435
1442
|
): void;
|
|
1436
1443
|
/**
|
|
1437
1444
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -1453,13 +1460,13 @@ declare module "fs" {
|
|
|
1453
1460
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1454
1461
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1455
1462
|
*/
|
|
1456
|
-
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<
|
|
1463
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1457
1464
|
/**
|
|
1458
1465
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1459
1466
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1460
1467
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1461
1468
|
*/
|
|
1462
|
-
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string |
|
|
1469
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1463
1470
|
/**
|
|
1464
1471
|
* Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html).
|
|
1465
1472
|
*
|
|
@@ -1485,12 +1492,12 @@ declare module "fs" {
|
|
|
1485
1492
|
function native(
|
|
1486
1493
|
path: PathLike,
|
|
1487
1494
|
options: BufferEncodingOption,
|
|
1488
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath:
|
|
1495
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
|
|
1489
1496
|
): void;
|
|
1490
1497
|
function native(
|
|
1491
1498
|
path: PathLike,
|
|
1492
1499
|
options: EncodingOption,
|
|
1493
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string |
|
|
1500
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
|
|
1494
1501
|
): void;
|
|
1495
1502
|
function native(
|
|
1496
1503
|
path: PathLike,
|
|
@@ -1510,17 +1517,17 @@ declare module "fs" {
|
|
|
1510
1517
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1511
1518
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1512
1519
|
*/
|
|
1513
|
-
export function realpathSync(path: PathLike, options: BufferEncodingOption):
|
|
1520
|
+
export function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1514
1521
|
/**
|
|
1515
1522
|
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1516
1523
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1517
1524
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1518
1525
|
*/
|
|
1519
|
-
export function realpathSync(path: PathLike, options?: EncodingOption): string |
|
|
1526
|
+
export function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1520
1527
|
export namespace realpathSync {
|
|
1521
1528
|
function native(path: PathLike, options?: EncodingOption): string;
|
|
1522
|
-
function native(path: PathLike, options: BufferEncodingOption):
|
|
1523
|
-
function native(path: PathLike, options?: EncodingOption): string |
|
|
1529
|
+
function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1530
|
+
function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1524
1531
|
}
|
|
1525
1532
|
/**
|
|
1526
1533
|
* Asynchronously removes a file or symbolic link. No arguments other than a
|
|
@@ -1890,12 +1897,8 @@ declare module "fs" {
|
|
|
1890
1897
|
*/
|
|
1891
1898
|
export function mkdtemp(
|
|
1892
1899
|
prefix: string,
|
|
1893
|
-
options:
|
|
1894
|
-
|
|
1895
|
-
| {
|
|
1896
|
-
encoding: "buffer";
|
|
1897
|
-
},
|
|
1898
|
-
callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void,
|
|
1900
|
+
options: BufferEncodingOption,
|
|
1901
|
+
callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void,
|
|
1899
1902
|
): void;
|
|
1900
1903
|
/**
|
|
1901
1904
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -1905,7 +1908,7 @@ declare module "fs" {
|
|
|
1905
1908
|
export function mkdtemp(
|
|
1906
1909
|
prefix: string,
|
|
1907
1910
|
options: EncodingOption,
|
|
1908
|
-
callback: (err: NodeJS.ErrnoException | null, folder: string |
|
|
1911
|
+
callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void,
|
|
1909
1912
|
): void;
|
|
1910
1913
|
/**
|
|
1911
1914
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -1927,13 +1930,13 @@ declare module "fs" {
|
|
|
1927
1930
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1928
1931
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1929
1932
|
*/
|
|
1930
|
-
function __promisify__(prefix: string, options: BufferEncodingOption): Promise<
|
|
1933
|
+
function __promisify__(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1931
1934
|
/**
|
|
1932
1935
|
* Asynchronously creates a unique temporary directory.
|
|
1933
1936
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1934
1937
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1935
1938
|
*/
|
|
1936
|
-
function __promisify__(prefix: string, options?: EncodingOption): Promise<string |
|
|
1939
|
+
function __promisify__(prefix: string, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1937
1940
|
}
|
|
1938
1941
|
/**
|
|
1939
1942
|
* Returns the created directory path.
|
|
@@ -1951,13 +1954,13 @@ declare module "fs" {
|
|
|
1951
1954
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1952
1955
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1953
1956
|
*/
|
|
1954
|
-
export function mkdtempSync(prefix: string, options: BufferEncodingOption):
|
|
1957
|
+
export function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
|
|
1955
1958
|
/**
|
|
1956
1959
|
* Synchronously creates a unique temporary directory.
|
|
1957
1960
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1958
1961
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1959
1962
|
*/
|
|
1960
|
-
export function mkdtempSync(prefix: string, options?: EncodingOption): string |
|
|
1963
|
+
export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
|
|
1961
1964
|
/**
|
|
1962
1965
|
* 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 `'..'`.
|
|
1963
1966
|
*
|
|
@@ -1998,7 +2001,7 @@ declare module "fs" {
|
|
|
1998
2001
|
recursive?: boolean | undefined;
|
|
1999
2002
|
}
|
|
2000
2003
|
| "buffer",
|
|
2001
|
-
callback: (err: NodeJS.ErrnoException | null, files:
|
|
2004
|
+
callback: (err: NodeJS.ErrnoException | null, files: NonSharedBuffer[]) => void,
|
|
2002
2005
|
): void;
|
|
2003
2006
|
/**
|
|
2004
2007
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -2015,7 +2018,7 @@ declare module "fs" {
|
|
|
2015
2018
|
| BufferEncoding
|
|
2016
2019
|
| undefined
|
|
2017
2020
|
| null,
|
|
2018
|
-
callback: (err: NodeJS.ErrnoException | null, files: string[] |
|
|
2021
|
+
callback: (err: NodeJS.ErrnoException | null, files: string[] | NonSharedBuffer[]) => void,
|
|
2019
2022
|
): void;
|
|
2020
2023
|
/**
|
|
2021
2024
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -2050,7 +2053,7 @@ declare module "fs" {
|
|
|
2050
2053
|
withFileTypes: true;
|
|
2051
2054
|
recursive?: boolean | undefined;
|
|
2052
2055
|
},
|
|
2053
|
-
callback: (err: NodeJS.ErrnoException | null, files: Dirent<
|
|
2056
|
+
callback: (err: NodeJS.ErrnoException | null, files: Dirent<NonSharedBuffer>[]) => void,
|
|
2054
2057
|
): void;
|
|
2055
2058
|
export namespace readdir {
|
|
2056
2059
|
/**
|
|
@@ -2083,7 +2086,7 @@ declare module "fs" {
|
|
|
2083
2086
|
withFileTypes?: false | undefined;
|
|
2084
2087
|
recursive?: boolean | undefined;
|
|
2085
2088
|
},
|
|
2086
|
-
): Promise<
|
|
2089
|
+
): Promise<NonSharedBuffer[]>;
|
|
2087
2090
|
/**
|
|
2088
2091
|
* Asynchronous readdir(3) - read a directory.
|
|
2089
2092
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2098,7 +2101,7 @@ declare module "fs" {
|
|
|
2098
2101
|
})
|
|
2099
2102
|
| BufferEncoding
|
|
2100
2103
|
| null,
|
|
2101
|
-
): Promise<string[] |
|
|
2104
|
+
): Promise<string[] | NonSharedBuffer[]>;
|
|
2102
2105
|
/**
|
|
2103
2106
|
* Asynchronous readdir(3) - read a directory.
|
|
2104
2107
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2123,7 +2126,7 @@ declare module "fs" {
|
|
|
2123
2126
|
withFileTypes: true;
|
|
2124
2127
|
recursive?: boolean | undefined;
|
|
2125
2128
|
},
|
|
2126
|
-
): Promise<Dirent<
|
|
2129
|
+
): Promise<Dirent<NonSharedBuffer>[]>;
|
|
2127
2130
|
}
|
|
2128
2131
|
/**
|
|
2129
2132
|
* Reads the contents of the directory.
|
|
@@ -2163,7 +2166,7 @@ declare module "fs" {
|
|
|
2163
2166
|
recursive?: boolean | undefined;
|
|
2164
2167
|
}
|
|
2165
2168
|
| "buffer",
|
|
2166
|
-
):
|
|
2169
|
+
): NonSharedBuffer[];
|
|
2167
2170
|
/**
|
|
2168
2171
|
* Synchronous readdir(3) - read a directory.
|
|
2169
2172
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2178,7 +2181,7 @@ declare module "fs" {
|
|
|
2178
2181
|
})
|
|
2179
2182
|
| BufferEncoding
|
|
2180
2183
|
| null,
|
|
2181
|
-
): string[] |
|
|
2184
|
+
): string[] | NonSharedBuffer[];
|
|
2182
2185
|
/**
|
|
2183
2186
|
* Synchronous readdir(3) - read a directory.
|
|
2184
2187
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2203,7 +2206,7 @@ declare module "fs" {
|
|
|
2203
2206
|
withFileTypes: true;
|
|
2204
2207
|
recursive?: boolean | undefined;
|
|
2205
2208
|
},
|
|
2206
|
-
): Dirent<
|
|
2209
|
+
): Dirent<NonSharedBuffer>[];
|
|
2207
2210
|
/**
|
|
2208
2211
|
* Closes the file descriptor. No arguments other than a possible exception are
|
|
2209
2212
|
* given to the completion callback.
|
|
@@ -2570,7 +2573,7 @@ declare module "fs" {
|
|
|
2570
2573
|
encoding?: BufferEncoding | null,
|
|
2571
2574
|
): number;
|
|
2572
2575
|
export type ReadPosition = number | bigint;
|
|
2573
|
-
export interface
|
|
2576
|
+
export interface ReadOptions {
|
|
2574
2577
|
/**
|
|
2575
2578
|
* @default 0
|
|
2576
2579
|
*/
|
|
@@ -2584,9 +2587,15 @@ declare module "fs" {
|
|
|
2584
2587
|
*/
|
|
2585
2588
|
position?: ReadPosition | null | undefined;
|
|
2586
2589
|
}
|
|
2587
|
-
export interface
|
|
2588
|
-
buffer?:
|
|
2590
|
+
export interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
|
|
2591
|
+
buffer?: T | undefined;
|
|
2589
2592
|
}
|
|
2593
|
+
/** @deprecated Use `ReadOptions` instead. */
|
|
2594
|
+
// TODO: remove in future major
|
|
2595
|
+
export interface ReadSyncOptions extends ReadOptions {}
|
|
2596
|
+
/** @deprecated Use `ReadOptionsWithBuffer` instead. */
|
|
2597
|
+
// TODO: remove in future major
|
|
2598
|
+
export interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
|
|
2590
2599
|
/**
|
|
2591
2600
|
* Read data from the file specified by `fd`.
|
|
2592
2601
|
*
|
|
@@ -2621,15 +2630,15 @@ declare module "fs" {
|
|
|
2621
2630
|
* `position` defaults to `null`
|
|
2622
2631
|
* @since v12.17.0, 13.11.0
|
|
2623
2632
|
*/
|
|
2624
|
-
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2633
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
2625
2634
|
fd: number,
|
|
2626
|
-
options:
|
|
2635
|
+
options: ReadOptionsWithBuffer<TBuffer>,
|
|
2627
2636
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2628
2637
|
): void;
|
|
2629
2638
|
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2630
2639
|
fd: number,
|
|
2631
2640
|
buffer: TBuffer,
|
|
2632
|
-
options:
|
|
2641
|
+
options: ReadOptions,
|
|
2633
2642
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2634
2643
|
): void;
|
|
2635
2644
|
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
@@ -2639,7 +2648,7 @@ declare module "fs" {
|
|
|
2639
2648
|
): void;
|
|
2640
2649
|
export function read(
|
|
2641
2650
|
fd: number,
|
|
2642
|
-
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer:
|
|
2651
|
+
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void,
|
|
2643
2652
|
): void;
|
|
2644
2653
|
export namespace read {
|
|
2645
2654
|
/**
|
|
@@ -2659,16 +2668,16 @@ declare module "fs" {
|
|
|
2659
2668
|
bytesRead: number;
|
|
2660
2669
|
buffer: TBuffer;
|
|
2661
2670
|
}>;
|
|
2662
|
-
function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2671
|
+
function __promisify__<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
2663
2672
|
fd: number,
|
|
2664
|
-
options:
|
|
2673
|
+
options: ReadOptionsWithBuffer<TBuffer>,
|
|
2665
2674
|
): Promise<{
|
|
2666
2675
|
bytesRead: number;
|
|
2667
2676
|
buffer: TBuffer;
|
|
2668
2677
|
}>;
|
|
2669
2678
|
function __promisify__(fd: number): Promise<{
|
|
2670
2679
|
bytesRead: number;
|
|
2671
|
-
buffer:
|
|
2680
|
+
buffer: NonSharedBuffer;
|
|
2672
2681
|
}>;
|
|
2673
2682
|
}
|
|
2674
2683
|
/**
|
|
@@ -2690,7 +2699,7 @@ declare module "fs" {
|
|
|
2690
2699
|
* Similar to the above `fs.readSync` function, this version takes an optional `options` object.
|
|
2691
2700
|
* If no `options` object is specified, it will default with the above values.
|
|
2692
2701
|
*/
|
|
2693
|
-
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?:
|
|
2702
|
+
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
|
|
2694
2703
|
/**
|
|
2695
2704
|
* Asynchronously reads the entire contents of a file.
|
|
2696
2705
|
*
|
|
@@ -3356,7 +3365,7 @@ declare module "fs" {
|
|
|
3356
3365
|
encoding: "buffer";
|
|
3357
3366
|
})
|
|
3358
3367
|
| "buffer",
|
|
3359
|
-
listener?: WatchListener<
|
|
3368
|
+
listener?: WatchListener<NonSharedBuffer>,
|
|
3360
3369
|
): FSWatcher;
|
|
3361
3370
|
/**
|
|
3362
3371
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
@@ -3382,7 +3391,7 @@ declare module "fs" {
|
|
|
3382
3391
|
export function watch(
|
|
3383
3392
|
filename: PathLike,
|
|
3384
3393
|
options: WatchOptions | string,
|
|
3385
|
-
listener?: WatchListener<string |
|
|
3394
|
+
listener?: WatchListener<string | NonSharedBuffer>,
|
|
3386
3395
|
): FSWatcher;
|
|
3387
3396
|
/**
|
|
3388
3397
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
@@ -4100,27 +4109,29 @@ declare module "fs" {
|
|
|
4100
4109
|
* @since v12.9.0
|
|
4101
4110
|
* @param [position='null']
|
|
4102
4111
|
*/
|
|
4103
|
-
export function writev(
|
|
4112
|
+
export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4104
4113
|
fd: number,
|
|
4105
|
-
buffers:
|
|
4106
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers:
|
|
4114
|
+
buffers: TBuffers,
|
|
4115
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
|
|
4107
4116
|
): void;
|
|
4108
|
-
export function writev(
|
|
4117
|
+
export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4109
4118
|
fd: number,
|
|
4110
|
-
buffers:
|
|
4119
|
+
buffers: TBuffers,
|
|
4111
4120
|
position: number | null,
|
|
4112
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers:
|
|
4121
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
|
|
4113
4122
|
): void;
|
|
4114
|
-
|
|
4123
|
+
// Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
|
|
4124
|
+
// TODO: remove default in future major version
|
|
4125
|
+
export interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
|
|
4115
4126
|
bytesWritten: number;
|
|
4116
|
-
buffers:
|
|
4127
|
+
buffers: T;
|
|
4117
4128
|
}
|
|
4118
4129
|
export namespace writev {
|
|
4119
|
-
function __promisify__(
|
|
4130
|
+
function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4120
4131
|
fd: number,
|
|
4121
|
-
buffers:
|
|
4132
|
+
buffers: TBuffers,
|
|
4122
4133
|
position?: number,
|
|
4123
|
-
): Promise<WriteVResult
|
|
4134
|
+
): Promise<WriteVResult<TBuffers>>;
|
|
4124
4135
|
}
|
|
4125
4136
|
/**
|
|
4126
4137
|
* For detailed information, see the documentation of the asynchronous version of
|
|
@@ -4145,27 +4156,29 @@ declare module "fs" {
|
|
|
4145
4156
|
* @since v13.13.0, v12.17.0
|
|
4146
4157
|
* @param [position='null']
|
|
4147
4158
|
*/
|
|
4148
|
-
export function readv(
|
|
4159
|
+
export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4149
4160
|
fd: number,
|
|
4150
|
-
buffers:
|
|
4151
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers:
|
|
4161
|
+
buffers: TBuffers,
|
|
4162
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
|
|
4152
4163
|
): void;
|
|
4153
|
-
export function readv(
|
|
4164
|
+
export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4154
4165
|
fd: number,
|
|
4155
|
-
buffers:
|
|
4166
|
+
buffers: TBuffers,
|
|
4156
4167
|
position: number | null,
|
|
4157
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers:
|
|
4168
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
|
|
4158
4169
|
): void;
|
|
4159
|
-
|
|
4170
|
+
// Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
|
|
4171
|
+
// TODO: remove default in future major version
|
|
4172
|
+
export interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
|
|
4160
4173
|
bytesRead: number;
|
|
4161
|
-
buffers:
|
|
4174
|
+
buffers: T;
|
|
4162
4175
|
}
|
|
4163
4176
|
export namespace readv {
|
|
4164
|
-
function __promisify__(
|
|
4177
|
+
function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4165
4178
|
fd: number,
|
|
4166
|
-
buffers:
|
|
4179
|
+
buffers: TBuffers,
|
|
4167
4180
|
position?: number,
|
|
4168
|
-
): Promise<ReadVResult
|
|
4181
|
+
): Promise<ReadVResult<TBuffers>>;
|
|
4169
4182
|
}
|
|
4170
4183
|
/**
|
|
4171
4184
|
* 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
|
}
|