@componentor/fs 3.0.30 → 3.0.33
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 +41 -22
- package/dist/index.js +211 -148
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Type definitions for the VFS-based filesystem.
|
|
3
3
|
* Mirrors Node.js fs module interfaces.
|
|
4
4
|
*/
|
|
5
|
-
type Encoding = 'utf8' | 'utf-8' | 'ascii' | 'base64' | 'hex' | 'binary' | 'latin1' | 'ucs2' | 'ucs-2' | 'utf16le' | 'utf-16le';
|
|
5
|
+
type Encoding = 'utf8' | 'utf-8' | 'ascii' | 'base64' | 'hex' | 'binary' | 'latin1' | 'ucs2' | 'ucs-2' | 'utf16le' | 'utf-16le' | 'buffer';
|
|
6
6
|
interface ReadOptions {
|
|
7
7
|
encoding?: Encoding | null;
|
|
8
8
|
flag?: string;
|
|
@@ -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;
|
|
@@ -486,6 +486,13 @@ declare class VFSFileSystem {
|
|
|
486
486
|
*
|
|
487
487
|
* Returns a Promise that resolves when the new mode is ready. */
|
|
488
488
|
setMode(newMode: FSMode): Promise<void>;
|
|
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;
|
|
489
496
|
readFile(filePath: string, callback: (err: Error | null, data?: Uint8Array | string) => void): void;
|
|
490
497
|
readFile(filePath: string, options: ReadOptions | Encoding | null, callback: (err: Error | null, data?: Uint8Array | string) => void): void;
|
|
491
498
|
writeFile(filePath: string, data: string | Uint8Array, callback: (err: Error | null) => void): void;
|
|
@@ -498,7 +505,7 @@ declare class VFSFileSystem {
|
|
|
498
505
|
rmdir(filePath: string, options: RmdirOptions, callback: (err: Error | null) => void): void;
|
|
499
506
|
rm(filePath: string, callback: (err: Error | null) => void): void;
|
|
500
507
|
rm(filePath: string, options: RmOptions, callback: (err: Error | null) => void): void;
|
|
501
|
-
unlink(filePath: string, callback
|
|
508
|
+
unlink(filePath: string, callback?: (err: Error | null) => void): any;
|
|
502
509
|
readdir(filePath: string, callback: (err: Error | null, files?: string[] | Dirent[]) => void): void;
|
|
503
510
|
readdir(filePath: string, options: ReaddirOptions | Encoding | null, callback: (err: Error | null, files?: string[] | Dirent[]) => void): void;
|
|
504
511
|
stat(filePath: string, callback: (err: Error | null, stats?: Stats | BigIntStats) => void): void;
|
|
@@ -507,47 +514,53 @@ declare class VFSFileSystem {
|
|
|
507
514
|
lstat(filePath: string, options: StatOptions, callback: (err: Error | null, stats?: Stats | BigIntStats) => void): void;
|
|
508
515
|
access(filePath: string, callback: (err: Error | null) => void): void;
|
|
509
516
|
access(filePath: string, mode: number, callback: (err: Error | null) => void): void;
|
|
510
|
-
rename(oldPath: string, newPath: string, callback
|
|
517
|
+
rename(oldPath: string, newPath: string, callback?: (err: Error | null) => void): any;
|
|
511
518
|
copyFile(src: string, dest: string, callback: (err: Error | null) => void): void;
|
|
512
519
|
copyFile(src: string, dest: string, mode: number, callback: (err: Error | null) => void): void;
|
|
513
520
|
truncate(filePath: string, callback: (err: Error | null) => void): void;
|
|
514
521
|
truncate(filePath: string, len: number, callback: (err: Error | null) => void): void;
|
|
515
|
-
realpath(filePath: string, callback
|
|
516
|
-
chmod(filePath: string, mode: number, callback
|
|
517
|
-
chown(filePath: string, uid: number, gid: number, callback
|
|
518
|
-
utimes(filePath: string, atime: Date | number, mtime: Date | number, callback
|
|
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;
|
|
519
526
|
symlink(target: string, linkPath: string, callback: (err: Error | null) => void): void;
|
|
520
527
|
symlink(target: string, linkPath: string, type: string | null, callback: (err: Error | null) => void): void;
|
|
521
528
|
readlink(filePath: string, callback: (err: Error | null, linkString?: string | Uint8Array) => void): void;
|
|
522
529
|
readlink(filePath: string, options: {
|
|
523
530
|
encoding?: string | null;
|
|
524
531
|
} | string | null, callback: (err: Error | null, linkString?: string | Uint8Array) => void): void;
|
|
525
|
-
link(existingPath: string, newPath: string, callback
|
|
532
|
+
link(existingPath: string, newPath: string, callback?: (err: Error | null) => void): any;
|
|
526
533
|
open(filePath: string, flags: string | number, callback: (err: Error | null, fd?: number) => void): void;
|
|
527
534
|
open(filePath: string, flags: string | number, mode: number, callback: (err: Error | null, fd?: number) => void): void;
|
|
528
|
-
mkdtemp(prefix: string, callback
|
|
535
|
+
mkdtemp(prefix: string, callback?: (err: Error | null, folder?: string) => void): any;
|
|
529
536
|
cp(src: string, dest: string, callback: (err: Error | null) => void): void;
|
|
530
537
|
cp(src: string, dest: string, options: CpOptions, callback: (err: Error | null) => void): void;
|
|
531
|
-
fdatasync(fd: number, callback
|
|
532
|
-
fsync(fd: number, callback
|
|
533
|
-
fstat(fd: number, callback: (err: Error | null, stats?: Stats) => void): void;
|
|
534
|
-
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;
|
|
535
542
|
ftruncate(fd: number, callback: (err: Error | null) => void): void;
|
|
536
543
|
ftruncate(fd: number, len: number, callback: (err: Error | null) => void): void;
|
|
537
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;
|
|
538
551
|
write(fd: number, buffer: Uint8Array, offset: number, length: number, position: number | null, callback: (err: Error | null, bytesWritten?: number, buffer?: Uint8Array) => void): void;
|
|
539
552
|
write(fd: number, data: string, position: number | null | undefined, encoding: string | undefined, callback: (err: Error | null, bytesWritten?: number, data?: string) => void): void;
|
|
540
553
|
close(fd: number, callback?: (err: Error | null) => void): void;
|
|
541
|
-
exists(filePath: string, callback
|
|
542
|
-
opendir(filePath: string, callback
|
|
554
|
+
exists(filePath: string, callback?: (exists: boolean) => void): any;
|
|
555
|
+
opendir(filePath: string, callback?: (err: Error | null, dir?: Dir) => void): any;
|
|
543
556
|
glob(pattern: string, callback: (err: Error | null, matches?: string[]) => void): void;
|
|
544
557
|
glob(pattern: string, options: GlobOptions, callback: (err: Error | null, matches?: string[]) => void): void;
|
|
545
|
-
futimes(fd: number, atime: Date | number, mtime: Date | number, callback
|
|
546
|
-
fchmod(fd: number, mode: number, callback
|
|
547
|
-
fchown(fd: number, uid: number, gid: number, callback
|
|
548
|
-
lchmod(filePath: string, mode: number, callback
|
|
549
|
-
lchown(filePath: string, uid: number, gid: number, callback
|
|
550
|
-
lutimes(filePath: string, atime: Date | number, mtime: Date | number, callback
|
|
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;
|
|
551
564
|
}
|
|
552
565
|
declare class VFSPromises {
|
|
553
566
|
private _async;
|
|
@@ -641,6 +654,8 @@ declare class VFSPromises {
|
|
|
641
654
|
openAsBlob(filePath: string, options?: OpenAsBlobOptions): Promise<Blob>;
|
|
642
655
|
statfs(path: string): Promise<StatFs>;
|
|
643
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>;
|
|
644
659
|
fsync(_fd: number): Promise<void>;
|
|
645
660
|
fdatasync(_fd: number): Promise<void>;
|
|
646
661
|
flush(): Promise<void>;
|
|
@@ -665,6 +680,10 @@ declare class SimpleEventEmitter {
|
|
|
665
680
|
removeAllListeners(event?: string): this;
|
|
666
681
|
emit(event: string, ...args: unknown[]): boolean;
|
|
667
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[];
|
|
668
687
|
}
|
|
669
688
|
declare class NodeReadable extends SimpleEventEmitter {
|
|
670
689
|
private _readFn;
|