@types/node 22.15.33 → 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 +15 -0
- {node v22.15 → node v22.18}/assert.d.ts +19 -0
- {node v22.15 → node v22.18}/buffer.buffer.d.ts +9 -0
- {node v22.15 → node v22.18}/buffer.d.ts +14 -6
- {node v22.15 → node v22.18}/child_process.d.ts +89 -162
- {node v22.15 → node v22.18}/cluster.d.ts +4 -5
- {node v22.15 → node v22.18}/crypto.d.ts +203 -167
- {node v22.15 → node v22.18}/dgram.d.ts +9 -8
- {node v22.15 → node v22.18}/dns/promises.d.ts +11 -10
- {node v22.15 → node v22.18}/dns.d.ts +19 -20
- {node v22.15 → node v22.18}/events.d.ts +80 -35
- {node v22.15 → node v22.18}/fs/promises.d.ts +78 -56
- {node v22.15 → node v22.18}/fs.d.ts +153 -129
- node v22.18/globals.d.ts +172 -0
- node v22.18/globals.typedarray.d.ts +38 -0
- {node v22.15 → node v22.18}/http.d.ts +112 -32
- {node v22.15 → node v22.18}/http2.d.ts +45 -26
- {node v22.15 → node v22.18}/https.d.ts +96 -62
- {node v22.15 → node v22.18}/index.d.ts +7 -3
- node v22.15/inspector.d.ts → node v22.18/inspector.generated.d.ts +219 -10
- {node v22.15 → node v22.18}/module.d.ts +70 -13
- {node v22.15 → node v22.18}/net.d.ts +12 -11
- {node v22.15 → node v22.18}/os.d.ts +14 -3
- {node v22.15 → node v22.18}/package.json +3 -83
- {node v22.15 → node v22.18}/perf_hooks.d.ts +6 -8
- {node v22.15 → node v22.18}/process.d.ts +15 -27
- {node v22.15 → node v22.18}/readline/promises.d.ts +1 -2
- {node v22.15 → node v22.18}/repl.d.ts +3 -5
- {node v22.15 → node v22.18}/sqlite.d.ts +212 -6
- {node v22.15 → node v22.18}/stream/consumers.d.ts +2 -2
- {node v22.15 → node v22.18}/stream/web.d.ts +8 -0
- {node v22.15 → node v22.18}/stream.d.ts +29 -33
- {node v22.15 → node v22.18}/string_decoder.d.ts +2 -2
- node v22.18/test.d.ts +2162 -0
- {node v22.15 → node v22.18}/tls.d.ts +90 -66
- {node v22.15 → node v22.18}/ts5.6/buffer.buffer.d.ts +10 -2
- node v22.18/ts5.6/globals.typedarray.d.ts +34 -0
- {node v22.15 → node v22.18}/ts5.6/index.d.ts +7 -3
- {node v22.15 → node v22.18}/url.d.ts +13 -4
- {node v22.15 → node v22.18}/util.d.ts +21 -6
- {node v22.15 → node v22.18}/v8.d.ts +33 -35
- {node v22.15 → node v22.18}/vm.d.ts +21 -50
- {node v22.15 → node v22.18}/wasi.d.ts +1 -1
- node v22.18/web-globals/abortcontroller.d.ts +34 -0
- node v22.18/web-globals/domexception.d.ts +68 -0
- node v22.15/dom-events.d.ts → node v22.18/web-globals/events.d.ts +49 -51
- node v22.18/web-globals/fetch.d.ts +46 -0
- node v22.18/web-globals/navigator.d.ts +22 -0
- node v22.18/web-globals/storage.d.ts +24 -0
- {node v22.15 → node v22.18}/worker_threads.d.ts +86 -67
- {node v22.15 → node v22.18}/zlib.d.ts +33 -26
- node v22.15/README.md +0 -15
- node v22.15/globals.d.ts +0 -364
- node v22.15/globals.typedarray.d.ts +0 -21
- node v22.15/test.d.ts +0 -2278
- node v22.15/ts5.6/globals.typedarray.d.ts +0 -19
- {node v22.15 → node v22.18}/LICENSE +0 -0
- {node v22.15 → node v22.18}/assert/strict.d.ts +0 -0
- {node v22.15 → node v22.18}/async_hooks.d.ts +1 -1
- {node v22.15 → node v22.18}/compatibility/disposable.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/index.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/indexable.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/iterators.d.ts +0 -0
- {node v22.15 → node v22.18}/console.d.ts +0 -0
- {node v22.15 → node v22.18}/constants.d.ts +0 -0
- {node v22.15 → node v22.18}/diagnostics_channel.d.ts +0 -0
- {node v22.15 → node v22.18}/domain.d.ts +0 -0
- {node v22.15 → node v22.18}/path.d.ts +0 -0
- {node v22.15 → node v22.18}/punycode.d.ts +0 -0
- {node v22.15 → node v22.18}/querystring.d.ts +0 -0
- {node v22.15 → node v22.18}/readline.d.ts +0 -0
- {node v22.15 → node v22.18}/sea.d.ts +0 -0
- {node v22.15 → node v22.18}/stream/promises.d.ts +0 -0
- {node v22.15 → node v22.18}/timers/promises.d.ts +0 -0
- {node v22.15 → node v22.18}/timers.d.ts +0 -0
- {node v22.15 → node v22.18}/trace_events.d.ts +0 -0
- {node v22.15 → node v22.18}/tty.d.ts +0 -0
|
@@ -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";
|
|
@@ -243,8 +244,8 @@ declare module "fs" {
|
|
|
243
244
|
*/
|
|
244
245
|
name: Name;
|
|
245
246
|
/**
|
|
246
|
-
* The
|
|
247
|
-
* @since v20.12.0
|
|
247
|
+
* The path to the parent directory of the file this `fs.Dirent` object refers to.
|
|
248
|
+
* @since v20.12.0, v18.20.0
|
|
248
249
|
*/
|
|
249
250
|
parentPath: string;
|
|
250
251
|
/**
|
|
@@ -328,6 +329,20 @@ declare module "fs" {
|
|
|
328
329
|
* @since v12.12.0
|
|
329
330
|
*/
|
|
330
331
|
readSync(): Dirent | null;
|
|
332
|
+
/**
|
|
333
|
+
* Calls `dir.close()` if the directory handle is open, and returns a promise that
|
|
334
|
+
* fulfills when disposal is complete.
|
|
335
|
+
* @since v22.17.0
|
|
336
|
+
* @experimental
|
|
337
|
+
*/
|
|
338
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
339
|
+
/**
|
|
340
|
+
* Calls `dir.closeSync()` if the directory handle is open, and returns
|
|
341
|
+
* `undefined`.
|
|
342
|
+
* @since v22.17.0
|
|
343
|
+
* @experimental
|
|
344
|
+
*/
|
|
345
|
+
[Symbol.dispose](): void;
|
|
331
346
|
}
|
|
332
347
|
/**
|
|
333
348
|
* Class: fs.StatWatcher
|
|
@@ -388,23 +403,29 @@ declare module "fs" {
|
|
|
388
403
|
* 3. error
|
|
389
404
|
*/
|
|
390
405
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
391
|
-
addListener(event: "change", listener: (eventType: string, filename: string |
|
|
406
|
+
addListener(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
392
407
|
addListener(event: "close", listener: () => void): this;
|
|
393
408
|
addListener(event: "error", listener: (error: Error) => void): this;
|
|
394
409
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
395
|
-
on(event: "change", listener: (eventType: string, filename: string |
|
|
410
|
+
on(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
396
411
|
on(event: "close", listener: () => void): this;
|
|
397
412
|
on(event: "error", listener: (error: Error) => void): this;
|
|
398
413
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
399
|
-
once(event: "change", listener: (eventType: string, filename: string |
|
|
414
|
+
once(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
400
415
|
once(event: "close", listener: () => void): this;
|
|
401
416
|
once(event: "error", listener: (error: Error) => void): this;
|
|
402
417
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
403
|
-
prependListener(
|
|
418
|
+
prependListener(
|
|
419
|
+
event: "change",
|
|
420
|
+
listener: (eventType: string, filename: string | NonSharedBuffer) => void,
|
|
421
|
+
): this;
|
|
404
422
|
prependListener(event: "close", listener: () => void): this;
|
|
405
423
|
prependListener(event: "error", listener: (error: Error) => void): this;
|
|
406
424
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
407
|
-
prependOnceListener(
|
|
425
|
+
prependOnceListener(
|
|
426
|
+
event: "change",
|
|
427
|
+
listener: (eventType: string, filename: string | NonSharedBuffer) => void,
|
|
428
|
+
): this;
|
|
408
429
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
409
430
|
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
|
410
431
|
}
|
|
@@ -1320,7 +1341,7 @@ declare module "fs" {
|
|
|
1320
1341
|
export function readlink(
|
|
1321
1342
|
path: PathLike,
|
|
1322
1343
|
options: BufferEncodingOption,
|
|
1323
|
-
callback: (err: NodeJS.ErrnoException | null, linkString:
|
|
1344
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void,
|
|
1324
1345
|
): void;
|
|
1325
1346
|
/**
|
|
1326
1347
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -1330,7 +1351,7 @@ declare module "fs" {
|
|
|
1330
1351
|
export function readlink(
|
|
1331
1352
|
path: PathLike,
|
|
1332
1353
|
options: EncodingOption,
|
|
1333
|
-
callback: (err: NodeJS.ErrnoException | null, linkString: string |
|
|
1354
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void,
|
|
1334
1355
|
): void;
|
|
1335
1356
|
/**
|
|
1336
1357
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -1352,13 +1373,13 @@ declare module "fs" {
|
|
|
1352
1373
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1353
1374
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1354
1375
|
*/
|
|
1355
|
-
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<
|
|
1376
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1356
1377
|
/**
|
|
1357
1378
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
1358
1379
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1359
1380
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1360
1381
|
*/
|
|
1361
|
-
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string |
|
|
1382
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1362
1383
|
}
|
|
1363
1384
|
/**
|
|
1364
1385
|
* Returns the symbolic link's string value.
|
|
@@ -1377,13 +1398,13 @@ declare module "fs" {
|
|
|
1377
1398
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1378
1399
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1379
1400
|
*/
|
|
1380
|
-
export function readlinkSync(path: PathLike, options: BufferEncodingOption):
|
|
1401
|
+
export function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1381
1402
|
/**
|
|
1382
1403
|
* Synchronous readlink(2) - read value of a symbolic link.
|
|
1383
1404
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1384
1405
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1385
1406
|
*/
|
|
1386
|
-
export function readlinkSync(path: PathLike, options?: EncodingOption): string |
|
|
1407
|
+
export function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1387
1408
|
/**
|
|
1388
1409
|
* Asynchronously computes the canonical pathname by resolving `.`, `..`, and
|
|
1389
1410
|
* symbolic links.
|
|
@@ -1423,7 +1444,7 @@ declare module "fs" {
|
|
|
1423
1444
|
export function realpath(
|
|
1424
1445
|
path: PathLike,
|
|
1425
1446
|
options: BufferEncodingOption,
|
|
1426
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath:
|
|
1447
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
|
|
1427
1448
|
): void;
|
|
1428
1449
|
/**
|
|
1429
1450
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -1433,7 +1454,7 @@ declare module "fs" {
|
|
|
1433
1454
|
export function realpath(
|
|
1434
1455
|
path: PathLike,
|
|
1435
1456
|
options: EncodingOption,
|
|
1436
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string |
|
|
1457
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
|
|
1437
1458
|
): void;
|
|
1438
1459
|
/**
|
|
1439
1460
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -1455,13 +1476,13 @@ declare module "fs" {
|
|
|
1455
1476
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1456
1477
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1457
1478
|
*/
|
|
1458
|
-
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<
|
|
1479
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1459
1480
|
/**
|
|
1460
1481
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1461
1482
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1462
1483
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1463
1484
|
*/
|
|
1464
|
-
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string |
|
|
1485
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1465
1486
|
/**
|
|
1466
1487
|
* Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html).
|
|
1467
1488
|
*
|
|
@@ -1487,12 +1508,12 @@ declare module "fs" {
|
|
|
1487
1508
|
function native(
|
|
1488
1509
|
path: PathLike,
|
|
1489
1510
|
options: BufferEncodingOption,
|
|
1490
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath:
|
|
1511
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
|
|
1491
1512
|
): void;
|
|
1492
1513
|
function native(
|
|
1493
1514
|
path: PathLike,
|
|
1494
1515
|
options: EncodingOption,
|
|
1495
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string |
|
|
1516
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
|
|
1496
1517
|
): void;
|
|
1497
1518
|
function native(
|
|
1498
1519
|
path: PathLike,
|
|
@@ -1512,17 +1533,17 @@ declare module "fs" {
|
|
|
1512
1533
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1513
1534
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1514
1535
|
*/
|
|
1515
|
-
export function realpathSync(path: PathLike, options: BufferEncodingOption):
|
|
1536
|
+
export function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1516
1537
|
/**
|
|
1517
1538
|
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1518
1539
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1519
1540
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1520
1541
|
*/
|
|
1521
|
-
export function realpathSync(path: PathLike, options?: EncodingOption): string |
|
|
1542
|
+
export function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1522
1543
|
export namespace realpathSync {
|
|
1523
1544
|
function native(path: PathLike, options?: EncodingOption): string;
|
|
1524
|
-
function native(path: PathLike, options: BufferEncodingOption):
|
|
1525
|
-
function native(path: PathLike, options?: EncodingOption): string |
|
|
1545
|
+
function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1546
|
+
function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1526
1547
|
}
|
|
1527
1548
|
/**
|
|
1528
1549
|
* Asynchronously removes a file or symbolic link. No arguments other than a
|
|
@@ -1892,12 +1913,8 @@ declare module "fs" {
|
|
|
1892
1913
|
*/
|
|
1893
1914
|
export function mkdtemp(
|
|
1894
1915
|
prefix: string,
|
|
1895
|
-
options:
|
|
1896
|
-
|
|
1897
|
-
| {
|
|
1898
|
-
encoding: "buffer";
|
|
1899
|
-
},
|
|
1900
|
-
callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void,
|
|
1916
|
+
options: BufferEncodingOption,
|
|
1917
|
+
callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void,
|
|
1901
1918
|
): void;
|
|
1902
1919
|
/**
|
|
1903
1920
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -1907,7 +1924,7 @@ declare module "fs" {
|
|
|
1907
1924
|
export function mkdtemp(
|
|
1908
1925
|
prefix: string,
|
|
1909
1926
|
options: EncodingOption,
|
|
1910
|
-
callback: (err: NodeJS.ErrnoException | null, folder: string |
|
|
1927
|
+
callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void,
|
|
1911
1928
|
): void;
|
|
1912
1929
|
/**
|
|
1913
1930
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -1929,13 +1946,13 @@ declare module "fs" {
|
|
|
1929
1946
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1930
1947
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1931
1948
|
*/
|
|
1932
|
-
function __promisify__(prefix: string, options: BufferEncodingOption): Promise<
|
|
1949
|
+
function __promisify__(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1933
1950
|
/**
|
|
1934
1951
|
* Asynchronously creates a unique temporary directory.
|
|
1935
1952
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1936
1953
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1937
1954
|
*/
|
|
1938
|
-
function __promisify__(prefix: string, options?: EncodingOption): Promise<string |
|
|
1955
|
+
function __promisify__(prefix: string, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1939
1956
|
}
|
|
1940
1957
|
/**
|
|
1941
1958
|
* Returns the created directory path.
|
|
@@ -1953,13 +1970,13 @@ declare module "fs" {
|
|
|
1953
1970
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1954
1971
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1955
1972
|
*/
|
|
1956
|
-
export function mkdtempSync(prefix: string, options: BufferEncodingOption):
|
|
1973
|
+
export function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
|
|
1957
1974
|
/**
|
|
1958
1975
|
* Synchronously creates a unique temporary directory.
|
|
1959
1976
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1960
1977
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1961
1978
|
*/
|
|
1962
|
-
export function mkdtempSync(prefix: string, options?: EncodingOption): string |
|
|
1979
|
+
export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
|
|
1963
1980
|
/**
|
|
1964
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 `'..'`.
|
|
1965
1982
|
*
|
|
@@ -2000,7 +2017,7 @@ declare module "fs" {
|
|
|
2000
2017
|
recursive?: boolean | undefined;
|
|
2001
2018
|
}
|
|
2002
2019
|
| "buffer",
|
|
2003
|
-
callback: (err: NodeJS.ErrnoException | null, files:
|
|
2020
|
+
callback: (err: NodeJS.ErrnoException | null, files: NonSharedBuffer[]) => void,
|
|
2004
2021
|
): void;
|
|
2005
2022
|
/**
|
|
2006
2023
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -2017,7 +2034,7 @@ declare module "fs" {
|
|
|
2017
2034
|
| BufferEncoding
|
|
2018
2035
|
| undefined
|
|
2019
2036
|
| null,
|
|
2020
|
-
callback: (err: NodeJS.ErrnoException | null, files: string[] |
|
|
2037
|
+
callback: (err: NodeJS.ErrnoException | null, files: string[] | NonSharedBuffer[]) => void,
|
|
2021
2038
|
): void;
|
|
2022
2039
|
/**
|
|
2023
2040
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -2052,7 +2069,7 @@ declare module "fs" {
|
|
|
2052
2069
|
withFileTypes: true;
|
|
2053
2070
|
recursive?: boolean | undefined;
|
|
2054
2071
|
},
|
|
2055
|
-
callback: (err: NodeJS.ErrnoException | null, files: Dirent<
|
|
2072
|
+
callback: (err: NodeJS.ErrnoException | null, files: Dirent<NonSharedBuffer>[]) => void,
|
|
2056
2073
|
): void;
|
|
2057
2074
|
export namespace readdir {
|
|
2058
2075
|
/**
|
|
@@ -2085,7 +2102,7 @@ declare module "fs" {
|
|
|
2085
2102
|
withFileTypes?: false | undefined;
|
|
2086
2103
|
recursive?: boolean | undefined;
|
|
2087
2104
|
},
|
|
2088
|
-
): Promise<
|
|
2105
|
+
): Promise<NonSharedBuffer[]>;
|
|
2089
2106
|
/**
|
|
2090
2107
|
* Asynchronous readdir(3) - read a directory.
|
|
2091
2108
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2100,7 +2117,7 @@ declare module "fs" {
|
|
|
2100
2117
|
})
|
|
2101
2118
|
| BufferEncoding
|
|
2102
2119
|
| null,
|
|
2103
|
-
): Promise<string[] |
|
|
2120
|
+
): Promise<string[] | NonSharedBuffer[]>;
|
|
2104
2121
|
/**
|
|
2105
2122
|
* Asynchronous readdir(3) - read a directory.
|
|
2106
2123
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2125,7 +2142,7 @@ declare module "fs" {
|
|
|
2125
2142
|
withFileTypes: true;
|
|
2126
2143
|
recursive?: boolean | undefined;
|
|
2127
2144
|
},
|
|
2128
|
-
): Promise<Dirent<
|
|
2145
|
+
): Promise<Dirent<NonSharedBuffer>[]>;
|
|
2129
2146
|
}
|
|
2130
2147
|
/**
|
|
2131
2148
|
* Reads the contents of the directory.
|
|
@@ -2165,7 +2182,7 @@ declare module "fs" {
|
|
|
2165
2182
|
recursive?: boolean | undefined;
|
|
2166
2183
|
}
|
|
2167
2184
|
| "buffer",
|
|
2168
|
-
):
|
|
2185
|
+
): NonSharedBuffer[];
|
|
2169
2186
|
/**
|
|
2170
2187
|
* Synchronous readdir(3) - read a directory.
|
|
2171
2188
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2180,7 +2197,7 @@ declare module "fs" {
|
|
|
2180
2197
|
})
|
|
2181
2198
|
| BufferEncoding
|
|
2182
2199
|
| null,
|
|
2183
|
-
): string[] |
|
|
2200
|
+
): string[] | NonSharedBuffer[];
|
|
2184
2201
|
/**
|
|
2185
2202
|
* Synchronous readdir(3) - read a directory.
|
|
2186
2203
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2205,7 +2222,7 @@ declare module "fs" {
|
|
|
2205
2222
|
withFileTypes: true;
|
|
2206
2223
|
recursive?: boolean | undefined;
|
|
2207
2224
|
},
|
|
2208
|
-
): Dirent<
|
|
2225
|
+
): Dirent<NonSharedBuffer>[];
|
|
2209
2226
|
/**
|
|
2210
2227
|
* Closes the file descriptor. No arguments other than a possible exception are
|
|
2211
2228
|
* given to the completion callback.
|
|
@@ -2371,7 +2388,7 @@ declare module "fs" {
|
|
|
2371
2388
|
/**
|
|
2372
2389
|
* @default null
|
|
2373
2390
|
*/
|
|
2374
|
-
position?: number |
|
|
2391
|
+
position?: number | null | undefined;
|
|
2375
2392
|
}
|
|
2376
2393
|
/**
|
|
2377
2394
|
* Write `buffer` to the file specified by `fd`.
|
|
@@ -2572,7 +2589,7 @@ declare module "fs" {
|
|
|
2572
2589
|
encoding?: BufferEncoding | null,
|
|
2573
2590
|
): number;
|
|
2574
2591
|
export type ReadPosition = number | bigint;
|
|
2575
|
-
export interface
|
|
2592
|
+
export interface ReadOptions {
|
|
2576
2593
|
/**
|
|
2577
2594
|
* @default 0
|
|
2578
2595
|
*/
|
|
@@ -2586,9 +2603,15 @@ declare module "fs" {
|
|
|
2586
2603
|
*/
|
|
2587
2604
|
position?: ReadPosition | null | undefined;
|
|
2588
2605
|
}
|
|
2589
|
-
export interface
|
|
2590
|
-
buffer?:
|
|
2606
|
+
export interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
|
|
2607
|
+
buffer?: T | undefined;
|
|
2591
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> {}
|
|
2592
2615
|
/**
|
|
2593
2616
|
* Read data from the file specified by `fd`.
|
|
2594
2617
|
*
|
|
@@ -2623,15 +2646,15 @@ declare module "fs" {
|
|
|
2623
2646
|
* `position` defaults to `null`
|
|
2624
2647
|
* @since v12.17.0, 13.11.0
|
|
2625
2648
|
*/
|
|
2626
|
-
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2649
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
2627
2650
|
fd: number,
|
|
2628
|
-
options:
|
|
2651
|
+
options: ReadOptionsWithBuffer<TBuffer>,
|
|
2629
2652
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2630
2653
|
): void;
|
|
2631
2654
|
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2632
2655
|
fd: number,
|
|
2633
2656
|
buffer: TBuffer,
|
|
2634
|
-
options:
|
|
2657
|
+
options: ReadOptions,
|
|
2635
2658
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2636
2659
|
): void;
|
|
2637
2660
|
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
@@ -2641,7 +2664,7 @@ declare module "fs" {
|
|
|
2641
2664
|
): void;
|
|
2642
2665
|
export function read(
|
|
2643
2666
|
fd: number,
|
|
2644
|
-
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer:
|
|
2667
|
+
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void,
|
|
2645
2668
|
): void;
|
|
2646
2669
|
export namespace read {
|
|
2647
2670
|
/**
|
|
@@ -2661,16 +2684,16 @@ declare module "fs" {
|
|
|
2661
2684
|
bytesRead: number;
|
|
2662
2685
|
buffer: TBuffer;
|
|
2663
2686
|
}>;
|
|
2664
|
-
function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2687
|
+
function __promisify__<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
2665
2688
|
fd: number,
|
|
2666
|
-
options:
|
|
2689
|
+
options: ReadOptionsWithBuffer<TBuffer>,
|
|
2667
2690
|
): Promise<{
|
|
2668
2691
|
bytesRead: number;
|
|
2669
2692
|
buffer: TBuffer;
|
|
2670
2693
|
}>;
|
|
2671
2694
|
function __promisify__(fd: number): Promise<{
|
|
2672
2695
|
bytesRead: number;
|
|
2673
|
-
buffer:
|
|
2696
|
+
buffer: NonSharedBuffer;
|
|
2674
2697
|
}>;
|
|
2675
2698
|
}
|
|
2676
2699
|
/**
|
|
@@ -2692,7 +2715,7 @@ declare module "fs" {
|
|
|
2692
2715
|
* Similar to the above `fs.readSync` function, this version takes an optional `options` object.
|
|
2693
2716
|
* If no `options` object is specified, it will default with the above values.
|
|
2694
2717
|
*/
|
|
2695
|
-
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?:
|
|
2718
|
+
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
|
|
2696
2719
|
/**
|
|
2697
2720
|
* Asynchronously reads the entire contents of a file.
|
|
2698
2721
|
*
|
|
@@ -3327,6 +3350,12 @@ declare module "fs" {
|
|
|
3327
3350
|
persistent?: boolean | undefined;
|
|
3328
3351
|
recursive?: boolean | undefined;
|
|
3329
3352
|
}
|
|
3353
|
+
export interface WatchOptionsWithBufferEncoding extends WatchOptions {
|
|
3354
|
+
encoding: "buffer";
|
|
3355
|
+
}
|
|
3356
|
+
export interface WatchOptionsWithStringEncoding extends WatchOptions {
|
|
3357
|
+
encoding?: BufferEncoding | undefined;
|
|
3358
|
+
}
|
|
3330
3359
|
export type WatchEventType = "rename" | "change";
|
|
3331
3360
|
export type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
|
|
3332
3361
|
export type StatsListener = (curr: Stats, prev: Stats) => void;
|
|
@@ -3353,44 +3382,20 @@ declare module "fs" {
|
|
|
3353
3382
|
*/
|
|
3354
3383
|
export function watch(
|
|
3355
3384
|
filename: PathLike,
|
|
3356
|
-
options
|
|
3357
|
-
|
|
3358
|
-
encoding: "buffer";
|
|
3359
|
-
})
|
|
3360
|
-
| "buffer",
|
|
3361
|
-
listener?: WatchListener<Buffer>,
|
|
3385
|
+
options?: WatchOptionsWithStringEncoding | BufferEncoding | null,
|
|
3386
|
+
listener?: WatchListener<string>,
|
|
3362
3387
|
): FSWatcher;
|
|
3363
|
-
/**
|
|
3364
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
3365
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
3366
|
-
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
3367
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
3368
|
-
* If `persistent` is not supplied, the default of `true` is used.
|
|
3369
|
-
* If `recursive` is not supplied, the default of `false` is used.
|
|
3370
|
-
*/
|
|
3371
3388
|
export function watch(
|
|
3372
3389
|
filename: PathLike,
|
|
3373
|
-
options
|
|
3374
|
-
listener
|
|
3390
|
+
options: WatchOptionsWithBufferEncoding | "buffer",
|
|
3391
|
+
listener: WatchListener<NonSharedBuffer>,
|
|
3375
3392
|
): FSWatcher;
|
|
3376
|
-
/**
|
|
3377
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
3378
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
3379
|
-
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
3380
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
3381
|
-
* If `persistent` is not supplied, the default of `true` is used.
|
|
3382
|
-
* If `recursive` is not supplied, the default of `false` is used.
|
|
3383
|
-
*/
|
|
3384
3393
|
export function watch(
|
|
3385
3394
|
filename: PathLike,
|
|
3386
|
-
options: WatchOptions |
|
|
3387
|
-
listener
|
|
3395
|
+
options: WatchOptions | BufferEncoding | "buffer" | null,
|
|
3396
|
+
listener: WatchListener<string | NonSharedBuffer>,
|
|
3388
3397
|
): FSWatcher;
|
|
3389
|
-
|
|
3390
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
3391
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
3392
|
-
*/
|
|
3393
|
-
export function watch(filename: PathLike, listener?: WatchListener<string>): FSWatcher;
|
|
3398
|
+
export function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
|
|
3394
3399
|
/**
|
|
3395
3400
|
* Test whether or not the given path exists by checking with the file system.
|
|
3396
3401
|
* Then call the `callback` argument with either true or false:
|
|
@@ -4099,27 +4104,29 @@ declare module "fs" {
|
|
|
4099
4104
|
* @since v12.9.0
|
|
4100
4105
|
* @param [position='null']
|
|
4101
4106
|
*/
|
|
4102
|
-
export function writev(
|
|
4107
|
+
export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4103
4108
|
fd: number,
|
|
4104
|
-
buffers:
|
|
4105
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers:
|
|
4109
|
+
buffers: TBuffers,
|
|
4110
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
|
|
4106
4111
|
): void;
|
|
4107
|
-
export function writev(
|
|
4112
|
+
export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4108
4113
|
fd: number,
|
|
4109
|
-
buffers:
|
|
4114
|
+
buffers: TBuffers,
|
|
4110
4115
|
position: number | null,
|
|
4111
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers:
|
|
4116
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
|
|
4112
4117
|
): void;
|
|
4113
|
-
|
|
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[]> {
|
|
4114
4121
|
bytesWritten: number;
|
|
4115
|
-
buffers:
|
|
4122
|
+
buffers: T;
|
|
4116
4123
|
}
|
|
4117
4124
|
export namespace writev {
|
|
4118
|
-
function __promisify__(
|
|
4125
|
+
function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4119
4126
|
fd: number,
|
|
4120
|
-
buffers:
|
|
4127
|
+
buffers: TBuffers,
|
|
4121
4128
|
position?: number,
|
|
4122
|
-
): Promise<WriteVResult
|
|
4129
|
+
): Promise<WriteVResult<TBuffers>>;
|
|
4123
4130
|
}
|
|
4124
4131
|
/**
|
|
4125
4132
|
* For detailed information, see the documentation of the asynchronous version of
|
|
@@ -4144,27 +4151,29 @@ declare module "fs" {
|
|
|
4144
4151
|
* @since v13.13.0, v12.17.0
|
|
4145
4152
|
* @param [position='null']
|
|
4146
4153
|
*/
|
|
4147
|
-
export function readv(
|
|
4154
|
+
export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4148
4155
|
fd: number,
|
|
4149
|
-
buffers:
|
|
4150
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers:
|
|
4156
|
+
buffers: TBuffers,
|
|
4157
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
|
|
4151
4158
|
): void;
|
|
4152
|
-
export function readv(
|
|
4159
|
+
export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4153
4160
|
fd: number,
|
|
4154
|
-
buffers:
|
|
4161
|
+
buffers: TBuffers,
|
|
4155
4162
|
position: number | null,
|
|
4156
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers:
|
|
4163
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
|
|
4157
4164
|
): void;
|
|
4158
|
-
|
|
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[]> {
|
|
4159
4168
|
bytesRead: number;
|
|
4160
|
-
buffers:
|
|
4169
|
+
buffers: T;
|
|
4161
4170
|
}
|
|
4162
4171
|
export namespace readv {
|
|
4163
|
-
function __promisify__(
|
|
4172
|
+
function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4164
4173
|
fd: number,
|
|
4165
|
-
buffers:
|
|
4174
|
+
buffers: TBuffers,
|
|
4166
4175
|
position?: number,
|
|
4167
|
-
): Promise<ReadVResult
|
|
4176
|
+
): Promise<ReadVResult<TBuffers>>;
|
|
4168
4177
|
}
|
|
4169
4178
|
/**
|
|
4170
4179
|
* For detailed information, see the documentation of the asynchronous version of
|
|
@@ -4200,7 +4209,6 @@ declare module "fs" {
|
|
|
4200
4209
|
* blob.stream();
|
|
4201
4210
|
* ```
|
|
4202
4211
|
* @since v19.8.0
|
|
4203
|
-
* @experimental
|
|
4204
4212
|
*/
|
|
4205
4213
|
export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
|
|
4206
4214
|
|
|
@@ -4219,7 +4227,7 @@ declare module "fs" {
|
|
|
4219
4227
|
/**
|
|
4220
4228
|
* @default false
|
|
4221
4229
|
*/
|
|
4222
|
-
recursive?: boolean;
|
|
4230
|
+
recursive?: boolean | undefined;
|
|
4223
4231
|
}
|
|
4224
4232
|
/**
|
|
4225
4233
|
* Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html).
|
|
@@ -4272,54 +4280,54 @@ declare module "fs" {
|
|
|
4272
4280
|
* Dereference symlinks
|
|
4273
4281
|
* @default false
|
|
4274
4282
|
*/
|
|
4275
|
-
dereference?: boolean;
|
|
4283
|
+
dereference?: boolean | undefined;
|
|
4276
4284
|
/**
|
|
4277
4285
|
* When `force` is `false`, and the destination
|
|
4278
4286
|
* exists, throw an error.
|
|
4279
4287
|
* @default false
|
|
4280
4288
|
*/
|
|
4281
|
-
errorOnExist?: boolean;
|
|
4289
|
+
errorOnExist?: boolean | undefined;
|
|
4282
4290
|
/**
|
|
4283
4291
|
* Overwrite existing file or directory. _The copy
|
|
4284
4292
|
* operation will ignore errors if you set this to false and the destination
|
|
4285
4293
|
* exists. Use the `errorOnExist` option to change this behavior.
|
|
4286
4294
|
* @default true
|
|
4287
4295
|
*/
|
|
4288
|
-
force?: boolean;
|
|
4296
|
+
force?: boolean | undefined;
|
|
4289
4297
|
/**
|
|
4290
4298
|
* Modifiers for copy operation. See `mode` flag of {@link copyFileSync()}
|
|
4291
4299
|
*/
|
|
4292
|
-
mode?: number;
|
|
4300
|
+
mode?: number | undefined;
|
|
4293
4301
|
/**
|
|
4294
4302
|
* When `true` timestamps from `src` will
|
|
4295
4303
|
* be preserved.
|
|
4296
4304
|
* @default false
|
|
4297
4305
|
*/
|
|
4298
|
-
preserveTimestamps?: boolean;
|
|
4306
|
+
preserveTimestamps?: boolean | undefined;
|
|
4299
4307
|
/**
|
|
4300
4308
|
* Copy directories recursively.
|
|
4301
4309
|
* @default false
|
|
4302
4310
|
*/
|
|
4303
|
-
recursive?: boolean;
|
|
4311
|
+
recursive?: boolean | undefined;
|
|
4304
4312
|
/**
|
|
4305
4313
|
* When true, path resolution for symlinks will be skipped
|
|
4306
4314
|
* @default false
|
|
4307
4315
|
*/
|
|
4308
|
-
verbatimSymlinks?: boolean;
|
|
4316
|
+
verbatimSymlinks?: boolean | undefined;
|
|
4309
4317
|
}
|
|
4310
4318
|
export interface CopyOptions extends CopyOptionsBase {
|
|
4311
4319
|
/**
|
|
4312
4320
|
* Function to filter copied files/directories. Return
|
|
4313
4321
|
* `true` to copy the item, `false` to ignore it.
|
|
4314
4322
|
*/
|
|
4315
|
-
filter
|
|
4323
|
+
filter?: ((source: string, destination: string) => boolean | Promise<boolean>) | undefined;
|
|
4316
4324
|
}
|
|
4317
4325
|
export interface CopySyncOptions extends CopyOptionsBase {
|
|
4318
4326
|
/**
|
|
4319
4327
|
* Function to filter copied files/directories. Return
|
|
4320
4328
|
* `true` to copy the item, `false` to ignore it.
|
|
4321
4329
|
*/
|
|
4322
|
-
filter
|
|
4330
|
+
filter?: ((source: string, destination: string) => boolean) | undefined;
|
|
4323
4331
|
}
|
|
4324
4332
|
/**
|
|
4325
4333
|
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
|
@@ -4361,7 +4369,7 @@ declare module "fs" {
|
|
|
4361
4369
|
* Current working directory.
|
|
4362
4370
|
* @default process.cwd()
|
|
4363
4371
|
*/
|
|
4364
|
-
cwd?: string | undefined;
|
|
4372
|
+
cwd?: string | URL | undefined;
|
|
4365
4373
|
/**
|
|
4366
4374
|
* `true` if the glob should return paths as `Dirent`s, `false` otherwise.
|
|
4367
4375
|
* @default false
|
|
@@ -4386,13 +4394,23 @@ declare module "fs" {
|
|
|
4386
4394
|
|
|
4387
4395
|
/**
|
|
4388
4396
|
* Retrieves the files matching the specified pattern.
|
|
4397
|
+
*
|
|
4398
|
+
* ```js
|
|
4399
|
+
* import { glob } from 'node:fs';
|
|
4400
|
+
*
|
|
4401
|
+
* glob('*.js', (err, matches) => {
|
|
4402
|
+
* if (err) throw err;
|
|
4403
|
+
* console.log(matches);
|
|
4404
|
+
* });
|
|
4405
|
+
* ```
|
|
4406
|
+
* @since v22.0.0
|
|
4389
4407
|
*/
|
|
4390
4408
|
export function glob(
|
|
4391
|
-
pattern: string | string[],
|
|
4409
|
+
pattern: string | readonly string[],
|
|
4392
4410
|
callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void,
|
|
4393
4411
|
): void;
|
|
4394
4412
|
export function glob(
|
|
4395
|
-
pattern: string | string[],
|
|
4413
|
+
pattern: string | readonly string[],
|
|
4396
4414
|
options: GlobOptionsWithFileTypes,
|
|
4397
4415
|
callback: (
|
|
4398
4416
|
err: NodeJS.ErrnoException | null,
|
|
@@ -4400,7 +4418,7 @@ declare module "fs" {
|
|
|
4400
4418
|
) => void,
|
|
4401
4419
|
): void;
|
|
4402
4420
|
export function glob(
|
|
4403
|
-
pattern: string | string[],
|
|
4421
|
+
pattern: string | readonly string[],
|
|
4404
4422
|
options: GlobOptionsWithoutFileTypes,
|
|
4405
4423
|
callback: (
|
|
4406
4424
|
err: NodeJS.ErrnoException | null,
|
|
@@ -4408,7 +4426,7 @@ declare module "fs" {
|
|
|
4408
4426
|
) => void,
|
|
4409
4427
|
): void;
|
|
4410
4428
|
export function glob(
|
|
4411
|
-
pattern: string | string[],
|
|
4429
|
+
pattern: string | readonly string[],
|
|
4412
4430
|
options: GlobOptions,
|
|
4413
4431
|
callback: (
|
|
4414
4432
|
err: NodeJS.ErrnoException | null,
|
|
@@ -4416,19 +4434,25 @@ declare module "fs" {
|
|
|
4416
4434
|
) => void,
|
|
4417
4435
|
): void;
|
|
4418
4436
|
/**
|
|
4419
|
-
*
|
|
4437
|
+
* ```js
|
|
4438
|
+
* import { globSync } from 'node:fs';
|
|
4439
|
+
*
|
|
4440
|
+
* console.log(globSync('*.js'));
|
|
4441
|
+
* ```
|
|
4442
|
+
* @since v22.0.0
|
|
4443
|
+
* @returns paths of files that match the pattern.
|
|
4420
4444
|
*/
|
|
4421
|
-
export function globSync(pattern: string | string[]): string[];
|
|
4445
|
+
export function globSync(pattern: string | readonly string[]): string[];
|
|
4422
4446
|
export function globSync(
|
|
4423
|
-
pattern: string | string[],
|
|
4447
|
+
pattern: string | readonly string[],
|
|
4424
4448
|
options: GlobOptionsWithFileTypes,
|
|
4425
4449
|
): Dirent[];
|
|
4426
4450
|
export function globSync(
|
|
4427
|
-
pattern: string | string[],
|
|
4451
|
+
pattern: string | readonly string[],
|
|
4428
4452
|
options: GlobOptionsWithoutFileTypes,
|
|
4429
4453
|
): string[];
|
|
4430
4454
|
export function globSync(
|
|
4431
|
-
pattern: string | string[],
|
|
4455
|
+
pattern: string | readonly string[],
|
|
4432
4456
|
options: GlobOptions,
|
|
4433
4457
|
): Dirent[] | string[];
|
|
4434
4458
|
}
|