@@ -448,6 +448,7 @@ declare namespace InternalFSBinding {
448
448
}
449
449
450
450
interface FSSyncContext {
451
+ fd ?: number ;
451
452
path ?: string ;
452
453
dest ?: string ;
453
454
errno ?: string ;
@@ -457,29 +458,87 @@ declare namespace InternalFSBinding {
457
458
}
458
459
459
460
type StringOrBuffer = string | Uint8Array ;
460
- const kUsePromises : symbol ;
461
-
462
- function access ( path : StringOrBuffer , mode : number , req : FSReqCallback ) : void ;
463
- function access ( path : StringOrBuffer , mode : number , usePromises : typeof kUsePromises ) : Promise < void > ;
464
- function access ( path : StringOrBuffer , mode : number , req : undefined , ctx : FSSyncContext ) : void ;
465
461
466
- function open ( path : StringOrBuffer , flags : number , mode : number , req : FSReqCallback < number > ) : void ;
467
- function open ( path : StringOrBuffer , flags : number , mode : number , req : undefined , ctx : FSSyncContext ) : number ;
462
+ const kUsePromises : symbol ;
468
463
469
464
interface FileHandle {
470
465
fd : number ;
471
466
getAsyncId ( ) : number ;
472
467
close ( ) : Promise < void > ;
473
468
}
474
- function openFileHandle ( path : StringOrBuffer , flags : number , mode : number , usePromises : typeof kUsePromises ) : Promise < FileHandle > ;
469
+
470
+ type ReaddirResult = string [ ] | [ string [ ] , number [ ] ] ;
471
+ type ReadlinkResult = string | Buffer ;
472
+ type StatResult = Float64Array | BigUint64Array ;
473
+
474
+ function access ( path : StringOrBuffer , mode : number , req : FSReqCallback ) : void ;
475
+ function access ( path : StringOrBuffer , mode : number , usePromises : typeof kUsePromises ) : Promise < void > ;
476
+ function access ( path : StringOrBuffer , mode : number , req : undefined , ctx : FSSyncContext ) : void ;
477
+
478
+ function chmod ( path : string , mode : number , req : FSReqCallback ) : void ;
479
+ function chmod ( path : string , mode : number , req : undefined , ctx : FSSyncContext ) : void ;
480
+ function chmod ( path : string , mode : number , usePromises : typeof kUsePromises ) : Promise < void > ;
481
+
482
+ function chown ( path : string , uid : number , gid : number , req : FSReqCallback ) : void ;
483
+ function chown ( path : string , uid : number , gid : number , req : undefined , ctx : FSSyncContext ) : void ;
484
+ function chown ( path : string , uid : number , gid : number , usePromises : typeof kUsePromises ) : Promise < void > ;
475
485
476
486
function close ( fd : number , req : FSReqCallback ) : void ;
477
487
function close ( fd : number , req : undefined , ctx : FSSyncContext ) : void ;
478
488
489
+ function fchmod ( fd : number , mode : number , req : FSReqCallback ) : void ;
490
+ function fchmod ( fd : number , mode : number , req : undefined , ctx : FSSyncContext ) : void ;
491
+ function fchmod ( fd : number , mode : number , usePromises : typeof kUsePromises ) : Promise < void > ;
492
+
493
+ function fchown ( fd : number , uid : number , gid : number , req : FSReqCallback ) : void ;
494
+ function fchown ( fd : number , uid : number , gid : number , req : undefined , ctx : FSSyncContext ) : void ;
495
+ function fchown ( fd : number , uid : number , gid : number , usePromises : typeof kUsePromises ) : Promise < void > ;
496
+
497
+ function fdatasync ( fd : number , req : FSReqCallback ) : void ;
498
+ function fdatasync ( fd : number , req : undefined , ctx : FSSyncContext ) : void ;
499
+ function fdatasync ( fd : number , usePromises : typeof kUsePromises ) : Promise < void > ;
500
+
501
+ function fstat ( fd : number , useBigint : boolean , req : FSReqCallback < StatResult > ) : void ;
502
+ function fstat ( fd : number , useBigint : boolean , usePromises : typeof kUsePromises ) : Promise < StatResult > ;
503
+ function fstat ( fd : number , useBigint : boolean , req : undefined , ctx : FSSyncContext ) : StatResult ;
504
+
505
+ function fsync ( fd : number , req : FSReqCallback ) : void ;
506
+ function fsync ( fd : number , req : undefined , ctx : FSSyncContext ) : void ;
507
+ function fsync ( fd : number , usePromises : typeof kUsePromises ) : Promise < void > ;
508
+
479
509
function ftruncate ( fd : number , len : number , req : FSReqCallback ) : void ;
480
510
function ftruncate ( fd : number , len : number , req : undefined , ctx : FSSyncContext ) : void ;
481
511
function ftruncate ( fd : number , len : number , usePromises : typeof kUsePromises ) : Promise < void > ;
482
512
513
+ function futimes ( fd : number , atime : number , mtime : number , req : FSReqCallback ) : void ;
514
+ function futimes ( fd : number , atime : number , mtime : number , req : undefined , ctx : FSSyncContext ) : void ;
515
+ function futimes ( fd : number , atime : number , mtime : number , usePromises : typeof kUsePromises ) : Promise < void > ;
516
+
517
+ function lchown ( path : string , uid : number , gid : number , req : FSReqCallback ) : void ;
518
+ function lchown ( path : string , uid : number , gid : number , req : undefined , ctx : FSSyncContext ) : void ;
519
+ function lchown ( path : string , uid : number , gid : number , usePromises : typeof kUsePromises ) : Promise < void > ;
520
+
521
+ function link ( existingPath : string , newPath : string , req : FSReqCallback ) : void ;
522
+ function link ( existingPath : string , newPath : string , req : undefined , ctx : FSSyncContext ) : void ;
523
+ function link ( existingPath : string , newPath : string , usePromises : typeof kUsePromises ) : void ;
524
+
525
+ function lstat ( path : StringOrBuffer , useBigint : boolean , req : FSReqCallback < StatResult > ) : void ;
526
+ function lstat ( path : StringOrBuffer , useBigint : boolean , usePromises : typeof kUsePromises ) : Promise < StatResult > ;
527
+ function lstat ( path : StringOrBuffer , useBigint : boolean , req : undefined , ctx : FSSyncContext ) : StatResult ;
528
+
529
+ function lutimes ( path : string , atime : number , mtime : number , req : FSReqCallback ) : void ;
530
+ function lutimes ( path : string , atime : number , mtime : number , req : undefined , ctx : FSSyncContext ) : void ;
531
+ function lutimes ( path : string , atime : number , mtime : number , usePromises : typeof kUsePromises ) : Promise < void > ;
532
+
533
+ function mkdir ( path : string , mode : number , recursive : boolean , req : FSReqCallback < void | string > ) : void ;
534
+ function mkdir ( path : string , mode : number , recursive : boolean , req : undefined , ctx : FSSyncContext ) : void | string ;
535
+ function mkdir ( path : string , mode : number , recursive : boolean , usePromises : typeof kUsePromises ) : Promise < void | string > ;
536
+
537
+ function open ( path : StringOrBuffer , flags : number , mode : number , req : FSReqCallback < number > ) : void ;
538
+ function open ( path : StringOrBuffer , flags : number , mode : number , req : undefined , ctx : FSSyncContext ) : number ;
539
+
540
+ function openFileHandle ( path : StringOrBuffer , flags : number , mode : number , usePromises : typeof kUsePromises ) : Promise < FileHandle > ;
541
+
483
542
function read ( fd : number , buffer : ArrayBufferView , offset : number , length : number , position : number , req : FSReqCallback < number > ) : void ;
484
543
function read ( fd : number , buffer : ArrayBufferView , offset : number , length : number , position : number , req : undefined , ctx : FSSyncContext ) : number ;
485
544
function read ( fd : number , buffer : ArrayBufferView , offset : number , length : number , position : number , usePromises : typeof kUsePromises ) : Promise < number > ;
@@ -488,12 +547,10 @@ declare namespace InternalFSBinding {
488
547
function readBuffers ( fd : number , buffers : ArrayBufferView [ ] , position : number , req : undefined , ctx : FSSyncContext ) : number ;
489
548
function readBuffers ( fd : number , buffers : ArrayBufferView [ ] , position : number , usePromises : typeof kUsePromises ) : Promise < number > ;
490
549
491
- type ReaddirResult = string [ ] | [ string [ ] , number [ ] ] ;
492
550
function readdir ( path : StringOrBuffer , encoding : unknown , withFileTypes : boolean , req : FSReqCallback < ReaddirResult > ) : void ;
493
551
function readdir ( path : StringOrBuffer , encoding : unknown , withFileTypes : boolean , req : undefined , ctx : FSSyncContext ) : ReaddirResult ;
494
552
function readdir ( path : StringOrBuffer , encoding : unknown , withFileTypes : boolean , usePromises : typeof kUsePromises ) : Promise < ReaddirResult > ;
495
553
496
- type ReadlinkResult = string | Buffer ;
497
554
function readlink ( path : StringOrBuffer , encoding : unknown , req : FSReqCallback < ReadlinkResult > ) : void ;
498
555
function readlink ( path : StringOrBuffer , encoding : unknown , req : undefined , ctx : FSSyncContext ) : ReadlinkResult ;
499
556
function readlink ( path : StringOrBuffer , encoding : unknown , usePromises : typeof kUsePromises ) : Promise < ReadlinkResult > ;
@@ -502,21 +559,26 @@ declare namespace InternalFSBinding {
502
559
function rename ( oldPath : string , newPath : string , req : undefined , ctx : FSSyncContext ) : void ;
503
560
function rename ( oldPath : string , newPath : string , usePromises : typeof kUsePromises ) : Promise < void > ;
504
561
505
- type StatResult = Float64Array | BigUint64Array ;
562
+ function rmdir ( path : string , req : FSReqCallback ) : void ;
563
+ function rmdir ( path : string , req : undefined , ctx : FSSyncContext ) : void ;
564
+ function rmdir ( path : string , usePromises : typeof kUsePromises ) : Promise < void > ;
565
+
506
566
function stat ( path : StringOrBuffer , useBigint : boolean , req : FSReqCallback < StatResult > ) : void ;
507
567
function stat ( path : StringOrBuffer , useBigint : boolean , usePromises : typeof kUsePromises ) : Promise < StatResult > ;
508
568
function stat ( path : StringOrBuffer , useBigint : boolean , req : undefined , ctx : FSSyncContext ) : StatResult ;
509
- function fstat ( fd : number , useBigint : boolean , req : FSReqCallback < StatResult > ) : void ;
510
- function fstat ( fd : number , useBigint : boolean , usePromises : typeof kUsePromises ) : Promise < StatResult > ;
511
- function fstat ( fd : number , useBigint : boolean , req : undefined , ctx : FSSyncContext ) : StatResult ;
512
- function lstat ( path : StringOrBuffer , useBigint : boolean , req : FSReqCallback < StatResult > ) : void ;
513
- function lstat ( path : StringOrBuffer , useBigint : boolean , usePromises : typeof kUsePromises ) : Promise < StatResult > ;
514
- function lstat ( path : StringOrBuffer , useBigint : boolean , req : undefined , ctx : FSSyncContext ) : StatResult ;
515
569
516
570
function symlink ( target : StringOrBuffer , path : StringOrBuffer , type : number , req : FSReqCallback ) : Promise < void > ;
517
571
function symlink ( target : StringOrBuffer , path : StringOrBuffer , type : number , req : undefined , ctx : FSSyncContext ) : Promise < void > ;
518
572
function symlink ( target : StringOrBuffer , path : StringOrBuffer , type : number , usePromises : typeof kUsePromises ) : Promise < void > ;
519
573
574
+ function unlink ( path : string , req : FSReqCallback ) : void ;
575
+ function unlink ( path : string , req : undefined , ctx : FSSyncContext ) : void ;
576
+ function unlink ( path : string , usePromises : typeof kUsePromises ) : Promise < void > ;
577
+
578
+ function utimes ( path : string , atime : number , mtime : number , req : FSReqCallback ) : void ;
579
+ function utimes ( path : string , atime : number , mtime : number , req : undefined , ctx : FSSyncContext ) : void ;
580
+ function utimes ( path : string , atime : number , mtime : number , usePromises : typeof kUsePromises ) : Promise < void > ;
581
+
520
582
function writeBuffer ( fd : number , buffer : ArrayBufferView , offset : number , length : number , position : number | null , req : FSReqCallback < number > ) : void ;
521
583
function writeBuffer ( fd : number , buffer : ArrayBufferView , offset : number , length : number , position : number | null , req : undefined , ctx : FSSyncContext ) : number ;
522
584
function writeBuffer ( fd : number , buffer : ArrayBufferView , offset : number , length : number , position : number | null , usePromises : typeof kUsePromises ) : Promise < number > ;
@@ -529,23 +591,38 @@ declare namespace InternalFSBinding {
529
591
function writeString ( fd : number , value : string , pos : unknown , encoding : unknown , req : undefined , ctx : FSSyncContext ) : number ;
530
592
function writeString ( fd : number , value : string , pos : unknown , encoding : unknown , usePromises : typeof kUsePromises ) : Promise < number > ;
531
593
}
594
+
532
595
declare function InternalBinding ( binding : 'fs' ) : {
533
596
FSReqCallback : typeof InternalFSBinding . FSReqCallback ;
534
597
kUsePromises : typeof InternalFSBinding . kUsePromises ;
535
598
access : typeof InternalFSBinding . access ;
536
- open : typeof InternalFSBinding . open ;
537
- openFileHandle : typeof InternalFSBinding . openFileHandle ;
599
+ chmod : typeof InternalFSBinding . chmod ;
600
+ chown : typeof InternalFSBinding . chown ;
538
601
close : typeof InternalFSBinding . close ;
602
+ fchmod : typeof InternalFSBinding . fchmod ;
603
+ fchown : typeof InternalFSBinding . fchown ;
604
+ fdatasync : typeof InternalFSBinding . fdatasync ;
605
+ fstat : typeof InternalFSBinding . fstat ;
606
+ fsync : typeof InternalFSBinding . fsync ;
539
607
ftruncate : typeof InternalFSBinding . ftruncate ;
608
+ futimes : typeof InternalFSBinding . futimes ;
609
+ lchown : typeof InternalFSBinding . lchown ;
610
+ link : typeof InternalFSBinding . link ;
611
+ lstat : typeof InternalFSBinding . lstat ;
612
+ lutimes : typeof InternalFSBinding . lutimes ;
613
+ mkdir : typeof InternalFSBinding . mkdir ;
614
+ open : typeof InternalFSBinding . open ;
615
+ openFileHandle : typeof InternalFSBinding . openFileHandle ;
540
616
read : typeof InternalFSBinding . read ;
541
617
readBuffers : typeof InternalFSBinding . readBuffers ;
542
618
readdir : typeof InternalFSBinding . readdir ;
543
619
readlink : typeof InternalFSBinding . readlink ;
544
620
rename : typeof InternalFSBinding . rename ;
621
+ rmdir : typeof InternalFSBinding . rmdir ;
545
622
stat : typeof InternalFSBinding . stat ;
546
- fstat : typeof InternalFSBinding . fstat ;
547
- lstat : typeof InternalFSBinding . lstat ;
548
623
symlink : typeof InternalFSBinding . symlink ;
624
+ unlink : typeof InternalFSBinding . unlink ;
625
+ utimes : typeof InternalFSBinding . utimes ;
549
626
writeBuffer : typeof InternalFSBinding . writeBuffer ;
550
627
writeBuffers : typeof InternalFSBinding . writeBuffers ;
551
628
writeString : typeof InternalFSBinding . writeString ;
0 commit comments