@componentor/fs 3.0.31 → 3.0.34

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.
package/dist/index.d.mts CHANGED
@@ -450,7 +450,7 @@ declare class VFSFileSystem {
450
450
  length?: number;
451
451
  position?: number | null;
452
452
  }, lengthOrEncoding?: number | string, position?: number | null): number;
453
- fstatSync(fd: number): Stats;
453
+ fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
454
454
  ftruncateSync(fd: number, len?: number): void;
455
455
  fdatasyncSync(fd: number): void;
456
456
  fsyncSync(fd: number): void;
@@ -487,6 +487,12 @@ declare class VFSFileSystem {
487
487
  * Returns a Promise that resolves when the new mode is ready. */
488
488
  setMode(newMode: FSMode): Promise<void>;
489
489
  private _validateCb;
490
+ /** Adapt a promise to optional Node.js callback style.
491
+ * If cb is a function: calls cb(err, result) via setTimeout. Returns void.
492
+ * If cb is missing: returns the promise (allows .then() or await). */
493
+ private _cb;
494
+ /** Like _cb but for void-returning promises (no result value). */
495
+ private _cbVoid;
490
496
  readFile(filePath: string, callback: (err: Error | null, data?: Uint8Array | string) => void): void;
491
497
  readFile(filePath: string, options: ReadOptions | Encoding | null, callback: (err: Error | null, data?: Uint8Array | string) => void): void;
492
498
  writeFile(filePath: string, data: string | Uint8Array, callback: (err: Error | null) => void): void;
@@ -499,7 +505,7 @@ declare class VFSFileSystem {
499
505
  rmdir(filePath: string, options: RmdirOptions, callback: (err: Error | null) => void): void;
500
506
  rm(filePath: string, callback: (err: Error | null) => void): void;
501
507
  rm(filePath: string, options: RmOptions, callback: (err: Error | null) => void): void;
502
- unlink(filePath: string, callback: (err: Error | null) => void): void;
508
+ unlink(filePath: string, callback?: (err: Error | null) => void): any;
503
509
  readdir(filePath: string, callback: (err: Error | null, files?: string[] | Dirent[]) => void): void;
504
510
  readdir(filePath: string, options: ReaddirOptions | Encoding | null, callback: (err: Error | null, files?: string[] | Dirent[]) => void): void;
505
511
  stat(filePath: string, callback: (err: Error | null, stats?: Stats | BigIntStats) => void): void;
@@ -508,47 +514,53 @@ declare class VFSFileSystem {
508
514
  lstat(filePath: string, options: StatOptions, callback: (err: Error | null, stats?: Stats | BigIntStats) => void): void;
509
515
  access(filePath: string, callback: (err: Error | null) => void): void;
510
516
  access(filePath: string, mode: number, callback: (err: Error | null) => void): void;
511
- rename(oldPath: string, newPath: string, callback: (err: Error | null) => void): void;
517
+ rename(oldPath: string, newPath: string, callback?: (err: Error | null) => void): any;
512
518
  copyFile(src: string, dest: string, callback: (err: Error | null) => void): void;
513
519
  copyFile(src: string, dest: string, mode: number, callback: (err: Error | null) => void): void;
514
520
  truncate(filePath: string, callback: (err: Error | null) => void): void;
515
521
  truncate(filePath: string, len: number, callback: (err: Error | null) => void): void;
516
- realpath(filePath: string, callback: (err: Error | null, resolvedPath?: string) => void): void;
517
- chmod(filePath: string, mode: number, callback: (err: Error | null) => void): void;
518
- chown(filePath: string, uid: number, gid: number, callback: (err: Error | null) => void): void;
519
- utimes(filePath: string, atime: Date | number, mtime: Date | number, callback: (err: Error | null) => void): void;
522
+ realpath(filePath: string, callback?: (err: Error | null, resolvedPath?: string) => void): any;
523
+ chmod(filePath: string, mode: number, callback?: (err: Error | null) => void): any;
524
+ chown(filePath: string, uid: number, gid: number, callback?: (err: Error | null) => void): any;
525
+ utimes(filePath: string, atime: Date | number, mtime: Date | number, callback?: (err: Error | null) => void): any;
520
526
  symlink(target: string, linkPath: string, callback: (err: Error | null) => void): void;
521
527
  symlink(target: string, linkPath: string, type: string | null, callback: (err: Error | null) => void): void;
522
528
  readlink(filePath: string, callback: (err: Error | null, linkString?: string | Uint8Array) => void): void;
523
529
  readlink(filePath: string, options: {
524
530
  encoding?: string | null;
525
531
  } | string | null, callback: (err: Error | null, linkString?: string | Uint8Array) => void): void;
526
- link(existingPath: string, newPath: string, callback: (err: Error | null) => void): void;
532
+ link(existingPath: string, newPath: string, callback?: (err: Error | null) => void): any;
527
533
  open(filePath: string, flags: string | number, callback: (err: Error | null, fd?: number) => void): void;
528
534
  open(filePath: string, flags: string | number, mode: number, callback: (err: Error | null, fd?: number) => void): void;
529
- mkdtemp(prefix: string, callback: (err: Error | null, folder?: string) => void): void;
535
+ mkdtemp(prefix: string, callback?: (err: Error | null, folder?: string) => void): any;
530
536
  cp(src: string, dest: string, callback: (err: Error | null) => void): void;
531
537
  cp(src: string, dest: string, options: CpOptions, callback: (err: Error | null) => void): void;
532
- fdatasync(fd: number, callback: (err: Error | null) => void): void;
533
- fsync(fd: number, callback: (err: Error | null) => void): void;
534
- fstat(fd: number, callback: (err: Error | null, stats?: Stats) => void): void;
535
- fstat(fd: number, options: any, callback: (err: Error | null, stats?: Stats) => void): void;
538
+ fdatasync(fd: number, callback?: (err: Error | null) => void): void;
539
+ fsync(fd: number, callback?: (err: Error | null) => void): void;
540
+ fstat(fd: number, callback: (err: Error | null, stats?: Stats | BigIntStats) => void): void;
541
+ fstat(fd: number, options: any, callback: (err: Error | null, stats?: Stats | BigIntStats) => void): void;
536
542
  ftruncate(fd: number, callback: (err: Error | null) => void): void;
537
543
  ftruncate(fd: number, len: number, callback: (err: Error | null) => void): void;
538
544
  read(fd: number, buffer: Uint8Array, offset: number, length: number, position: number | null, callback: (err: Error | null, bytesRead?: number, buffer?: Uint8Array) => void): void;
545
+ read(fd: number, options: {
546
+ buffer: Uint8Array;
547
+ offset?: number;
548
+ length?: number;
549
+ position?: number | null;
550
+ }, callback: (err: Error | null, bytesRead?: number, buffer?: Uint8Array) => void): void;
539
551
  write(fd: number, buffer: Uint8Array, offset: number, length: number, position: number | null, callback: (err: Error | null, bytesWritten?: number, buffer?: Uint8Array) => void): void;
540
552
  write(fd: number, data: string, position: number | null | undefined, encoding: string | undefined, callback: (err: Error | null, bytesWritten?: number, data?: string) => void): void;
541
553
  close(fd: number, callback?: (err: Error | null) => void): void;
542
- exists(filePath: string, callback: (exists: boolean) => void): void;
543
- opendir(filePath: string, callback: (err: Error | null, dir?: Dir) => void): void;
554
+ exists(filePath: string, callback?: (exists: boolean) => void): any;
555
+ opendir(filePath: string, callback?: (err: Error | null, dir?: Dir) => void): any;
544
556
  glob(pattern: string, callback: (err: Error | null, matches?: string[]) => void): void;
545
557
  glob(pattern: string, options: GlobOptions, callback: (err: Error | null, matches?: string[]) => void): void;
546
- futimes(fd: number, atime: Date | number, mtime: Date | number, callback: (err: Error | null) => void): void;
547
- fchmod(fd: number, mode: number, callback: (err: Error | null) => void): void;
548
- fchown(fd: number, uid: number, gid: number, callback: (err: Error | null) => void): void;
549
- lchmod(filePath: string, mode: number, callback: (err: Error | null) => void): void;
550
- lchown(filePath: string, uid: number, gid: number, callback: (err: Error | null) => void): void;
551
- lutimes(filePath: string, atime: Date | number, mtime: Date | number, callback: (err: Error | null) => void): void;
558
+ futimes(fd: number, atime: Date | number, mtime: Date | number, callback?: (err: Error | null) => void): void;
559
+ fchmod(fd: number, mode: number, callback?: (err: Error | null) => void): void;
560
+ fchown(fd: number, uid: number, gid: number, callback?: (err: Error | null) => void): void;
561
+ lchmod(filePath: string, mode: number, callback?: (err: Error | null) => void): any;
562
+ lchown(filePath: string, uid: number, gid: number, callback?: (err: Error | null) => void): any;
563
+ lutimes(filePath: string, atime: Date | number, mtime: Date | number, callback?: (err: Error | null) => void): any;
552
564
  }
553
565
  declare class VFSPromises {
554
566
  private _async;
@@ -642,6 +654,8 @@ declare class VFSPromises {
642
654
  openAsBlob(filePath: string, options?: OpenAsBlobOptions): Promise<Blob>;
643
655
  statfs(path: string): Promise<StatFs>;
644
656
  watch(filePath: string, options?: WatchOptions): AsyncIterable<WatchEventType>;
657
+ fstat(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
658
+ ftruncate(fd: number, len?: number): Promise<void>;
645
659
  fsync(_fd: number): Promise<void>;
646
660
  fdatasync(_fd: number): Promise<void>;
647
661
  flush(): Promise<void>;
@@ -666,6 +680,10 @@ declare class SimpleEventEmitter {
666
680
  removeAllListeners(event?: string): this;
667
681
  emit(event: string, ...args: unknown[]): boolean;
668
682
  listenerCount(event: string): number;
683
+ rawListeners(event: string): Function[];
684
+ prependListener(event: string, fn: Listener): this;
685
+ prependOnceListener(event: string, fn: Listener): this;
686
+ eventNames(): string[];
669
687
  }
670
688
  declare class NodeReadable extends SimpleEventEmitter {
671
689
  private _readFn;