//#region src/error.d.ts declare class BreadFSError extends Error { constructor(raw: unknown); get raw(): Error | undefined; } //#endregion //#region src/provider/types.d.ts type BufferEncoding$1 = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex'; interface EncodingOptions { encoding?: BufferEncoding$1; } interface StreamOptions { encoding?: BufferEncoding$1; } interface ReadStreamOptions extends StreamOptions {} interface WriteStreamOptions extends StreamOptions { contentLength?: number; } type ProgressHandler = (payload: { current: number; total: number; }) => void; interface ReadFileOptions { encoding?: BufferEncoding$1; onProgress?: ProgressHandler; } interface WriteFileOptions { encoding?: BufferEncoding$1; onProgress?: ProgressHandler; } interface MakeDirectoryOptions { /** * Indicates whether parent folders should be created. * If a folder was created, the path to the first created folder will be returned. * @default true */ recursive?: boolean | undefined; /** * A file mode. If a string is passed, it is parsed as an octal integer. If not specified * @default 0o777 */ mode?: number | string | undefined; } interface RemoveOptions { /** * When `true`, exceptions will be ignored if `path` does not exist. * @default true */ force?: boolean | undefined; /** * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or * `EPERM` error is encountered, Node.js will retry the operation with a linear * backoff wait of `retryDelay` ms longer on each try. This option represents the * number of retries. This option is ignored if the `recursive` option is not * `true`. * @default 0 */ maxRetries?: number | undefined; /** * If `true`, perform a recursive directory removal. In * recursive mode, operations are retried on failure. * @default true */ recursive?: boolean | undefined; /** * The amount of time in milliseconds to wait between retries. * This option is ignored if the `recursive` option is not `true`. * @default 100 */ retryDelay?: number | undefined; } type CopyMoveProgressHandler = (payload: { src: string; current: number; total: number | undefined; }) => void; interface CopyOptions { /** * Dereference symlinks. * @default false */ dereference?: boolean | undefined; /** * Overwrite existing file or directory. * _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ * Use the `errorOnExist` option to change this behavior. * @default true */ overwrite?: boolean | undefined; /** * When `true`, will set last modification and access times to the ones of the original source files. * When `false`, timestamp behavior is OS-dependent. * @default false */ preserveTimestamps?: boolean | undefined; /** * When `overwrite` is `false` and the destination exists, throw an error. * @default false */ errorOnExist?: boolean | undefined; /** * Function to filter copied files/directories. Return `true` to copy the item, `false` to ignore it. * Can also return a `Promise` that resolves to `true` or `false` (or pass in an `async` function). */ /** * Fallback copy */ fallback?: { file?: { read?: ReadFileOptions; write?: WriteFileOptions; }; stream?: { read?: ReadStreamOptions; write?: WriteStreamOptions; contentLength?: boolean; onProgress?: CopyMoveProgressHandler; }; }; } interface MoveOptions { /** * Overwrite existing file or directory. * @default false */ overwrite?: boolean | undefined; /** * Dereference symlinks. * @default false */ dereference?: boolean | undefined; /** * Fallback move */ fallback?: { file?: { read?: ReadFileOptions; write?: WriteFileOptions; remove?: RemoveOptions; }; stream?: { read?: ReadStreamOptions; write?: WriteStreamOptions; contentLength?: boolean; onProgress?: CopyMoveProgressHandler; }; }; } interface StatOptions { bigint?: boolean | undefined; } interface ListOptions { withFileTypes?: false | undefined; recursive?: boolean | undefined; } interface RawFileStat { path: string; size: number | bigint | undefined; isFile: () => boolean; isDirectory: () => boolean; isSymbolicLink: () => boolean; mtime: Date | undefined; birthtime: Date | undefined; } //#endregion //#region src/provider/index.d.ts interface BreadFSProvider { readonly name: T; mkdir: (path: string, options: MakeDirectoryOptions) => Promise; mkdirSync?: (path: string, options: MakeDirectoryOptions) => void; createReadStream: (path: string, options: ReadStreamOptions) => ReadableStream; createWriteStream: (path: string, options: WriteStreamOptions) => WritableStream; readFile: (path: string, options: ReadFileOptions) => Promise; readFileSync?: (path: string, options: ReadFileOptions) => Uint8Array; readText?: (path: string, options: EncodingOptions) => Promise; readTextSync?: (path: string, options: EncodingOptions) => string; writeFile: (path: string, buffer: Buffer | Uint8Array, options: WriteFileOptions) => Promise; writeFileSync?: (path: string, buffer: Buffer | Uint8Array, options: WriteFileOptions) => void; writeText?: (path: string, content: string, options: EncodingOptions) => Promise; writeTextSync?: (path: string, content: string, options: EncodingOptions) => void; copy?: (src: string, dst: string, options: CopyOptions) => Promise; copySync?: (src: string, dst: string, options: CopyOptions) => void; move?: (src: string, dst: string, options: MoveOptions) => Promise; moveSync?: (src: string, dst: string, options: MoveOptions) => void; remove: (path: string, options: RemoveOptions) => Promise; removeSync?: (path: string, options: RemoveOptions) => void; stat: (path: string, options: StatOptions) => Promise; statSync?: (path: string, options: StatOptions) => RawFileStat; exists: (path: string) => Promise; existsSync?: (path: string) => boolean; list: (path: string, options: ListOptions) => Promise; listSync?: (path: string, options: ListOptions) => string[]; listStat?: (path: string, options: ListOptions) => Promise; listStatSync?: (path: string, options: ListOptions) => RawFileStat[]; walk?: (path: string) => AsyncIterable; } //#endregion //#region src/breadfs.d.ts type Prettify = { [K in keyof T]: T[K] } & {}; type FileStat

> = Prettify<{ path: Path

; } & Omit>; type AcrossFileStat> = T extends Path ? FileStat : FileStat

; type AcrossPath> = T extends Path ? Path : Path

; declare class BreadFS

= BreadFSProvider> { readonly provider: P; constructor(provider: P); static of

>(provider: P): BreadFS

; get name(): P['name']; path(root: T, ...paths: string[]): AcrossPath; createReadStream(path: string | Path, options?: ReadStreamOptions): ReadableStream; createWriteStream(path: string | Path, options?: WriteStreamOptions): WritableStream; mkdir(path: T, options?: MakeDirectoryOptions): Promise; mkdirSync(path: T, options?: MakeDirectoryOptions): void; readFile(path: string | Path, options?: ReadFileOptions): Promise; readFileSync(path: string | Path, options?: ReadFileOptions): Uint8Array; readText(path: string | Path, options?: BufferEncoding | EncodingOptions): Promise; readTextSync(path: string | Path, options?: BufferEncoding | EncodingOptions): string; writeFile(path: string | Path, buffer: Buffer | Uint8Array, options?: WriteFileOptions): Promise; writeFileSync(path: string | Path, buffer: Buffer | Uint8Array, options?: WriteFileOptions): void; writeText(path: string | Path, content: string, options?: BufferEncoding | EncodingOptions): Promise; writeTextSync(path: string | Path, content: string, options?: BufferEncoding | EncodingOptions): void; /** * Remove a file or a directory recursively. * * @param path A file or a directory * @param options * @returns */ remove(path: string | Path, options?: RemoveOptions): Promise; removeSync(path: string | Path, options?: RemoveOptions): void; /** * Copy a file or directory, even across file systems. * * @param src Note that if `src` is a directory it will move everything inside of this directory, not the entire directory itself. * @param dst Note that if `src` is a file, `dst` cannot be a directory. * @param options * @returns */ copy(src: string | Path, dst: string | Path, options?: CopyOptions): Promise; copySync(src: string | Path, dst: string | Path, options?: CopyOptions): void; /** * Moves a file or directory, even across file systems. * * @param src Note that if `src` is a directory it will copy everything inside of this directory, not the entire directory itself. * @param dst Note that when `src` is a file, `dest` must be a file and when `src` is a directory, `dest` must be a directory. * @param options * @returns */ move(src: string | Path, dst: string | Path, options?: MoveOptions): Promise; moveSync(src: string | Path, dst: string | Path, options?: MoveOptions): void; exists(path: string | Path): Promise; existsSync(path: string | Path): boolean; stat(path: T, options?: StatOptions): Promise>; statSync(path: T, options?: StatOptions): AcrossFileStat; list(path: T, options?: ListOptions): Promise[]>; listSync(path: T, options?: ListOptions): AcrossPath[]; listStat(path: T, options?: ListOptions): Promise[]>; listStatSync(path: T, options?: ListOptions): AcrossFileStat[]; private matchFS; private runSync; private runAsync; } declare class Path

= BreadFSProvider> { private readonly _fs; private readonly _path; constructor(fs: BreadFS

, path: string); get fs(): BreadFS

; get path(): string; get basename(): string; get dirname(): string; get extname(): string; get isAbsolute(): boolean; relative(to: string | Path): Path

; join(...pieces: string[]): Path

; resolve(...pieces: string[]): Path

; createReadStream(options?: ReadStreamOptions): ReadableStream>; createWriteStream(options?: WriteStreamOptions): WritableStream>; mkdir(options?: MakeDirectoryOptions): Promise; mkdirSync(options?: MakeDirectoryOptions): void; ensureDir(options?: MakeDirectoryOptions): Promise; ensureDirSync(options?: MakeDirectoryOptions): void; stat(options?: StatOptions): Promise>; statSync(options?: StatOptions): FileStat

; isFile(): Promise; isFileSync(): boolean; isDirectory(): Promise; isDirectorySync(): boolean; isSymbolicLink(): Promise; isSymbolicLinkSync(): boolean; exists(): Promise; existsSync(): boolean; readFile(options?: ReadFileOptions): Promise; readFileSync(options?: ReadFileOptions): Uint8Array; readText(options?: BufferEncoding | EncodingOptions): Promise; readTextSync(options?: BufferEncoding | EncodingOptions): string; readJSON(): Promise; writeFile(buffer: Uint8Array, options?: WriteFileOptions): Promise; writeFileSync(buffer: Uint8Array, options?: WriteFileOptions): void; writeText(content: string, options?: BufferEncoding | EncodingOptions): Promise; writeTextSync(content: string, options?: BufferEncoding | EncodingOptions): void; writeJSON(value: T, replacer?: Parameters[1], space?: Parameters[2]): Promise; copyTo(dst: string | Path, options?: CopyOptions): Promise; copyToSync(dst: string | Path, options?: CopyOptions): void; moveTo(dst: string | Path, options?: MoveOptions): Promise; moveToSync(dst: string | Path, options?: MoveOptions): void; remove(options?: RemoveOptions): Promise; removeSync(options?: RemoveOptions): void; list(options?: ListOptions): Promise[]>; listSync(options?: ListOptions): Path

[]; listStat(options?: ListOptions): Promise[]>; listStatSync(options?: ListOptions): FileStat

[]; toString(): string; [Symbol.toStringTag](): string; } //#endregion export { BreadFS, BreadFSError, BreadFSProvider, BufferEncoding$1 as BufferEncoding, CopyOptions, EncodingOptions, FileStat, ListOptions, MakeDirectoryOptions, MoveOptions, Path, ProgressHandler, RawFileStat, ReadFileOptions, ReadStreamOptions, RemoveOptions, StatOptions, StreamOptions, WriteFileOptions, WriteStreamOptions };