/**
 * Node.js fs module shim
 * Wraps VirtualFS to provide Node.js compatible API
 */
import { VirtualFS } from '../virtual-fs';
import type { Stats, FSWatcher, WatchListener, WatchEventType } from '../virtual-fs';
import { Buffer } from './stream';
export type { FSWatcher, WatchListener, WatchEventType };
declare class StatsValue {
    isFile(): boolean;
    isDirectory(): boolean;
    isBlockDevice(): boolean;
    isCharacterDevice(): boolean;
    isSymbolicLink(): boolean;
    isFIFO(): boolean;
    isSocket(): boolean;
}
declare class DirValue {
}
export { StatsValue as Stats, DirValue as Dir };
export type PathLike = string | URL;
export type TimeLike = string | number | Date;
type StatWatcherListener = (curr: Stats, prev: Stats) => void;
export interface FsShim {
    readFileSync(path: PathLike): Buffer;
    readFileSync(path: PathLike, encoding: 'utf8' | 'utf-8'): string;
    readFileSync(path: PathLike, options: {
        encoding: 'utf8' | 'utf-8';
    }): string;
    readFileSync(path: PathLike, options: {
        encoding?: null;
    }): Buffer;
    writeFileSync(path: PathLike, data: string | Uint8Array): void;
    appendFileSync(path: PathLike, data: string | Uint8Array): void;
    truncateSync(path: PathLike, len?: number): void;
    existsSync(path: PathLike): boolean;
    mkdirSync(path: PathLike, options?: {
        recursive?: boolean;
    }): void;
    readdirSync(path: PathLike): string[];
    readdirSync(path: PathLike, options: {
        withFileTypes: true;
    }): Dirent[];
    readdirSync(path: PathLike, options?: {
        withFileTypes?: boolean;
        encoding?: string;
    } | string): string[] | Dirent[];
    statSync(path: PathLike): Stats;
    lstatSync(path: PathLike): Stats;
    fstatSync(fd: number): Stats;
    unlinkSync(path: PathLike): void;
    rmdirSync(path: PathLike): void;
    renameSync(oldPath: PathLike, newPath: PathLike): void;
    realpathSync(path: PathLike): string;
    accessSync(path: PathLike, mode?: number): void;
    copyFileSync(src: PathLike, dest: PathLike): void;
    linkSync(existingPath: PathLike, newPath: PathLike): void;
    symlinkSync(target: PathLike, path: PathLike, type?: string): void;
    readlinkSync(path: PathLike): string;
    utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
    chmodSync(path: PathLike, mode: number): void;
    chownSync(path: PathLike, uid: number, gid: number): void;
    openSync(path: string, flags: string | number, mode?: number): number;
    closeSync(fd: number): void;
    readSync(fd: number, buffer: Buffer | Uint8Array, offset: number, length: number, position: number | null): number;
    writeSync(fd: number, buffer: Buffer | Uint8Array | string, offset?: number, length?: number, position?: number | null): number;
    ftruncateSync(fd: number, len?: number): void;
    fsyncSync(fd: number): void;
    fdatasyncSync(fd: number): void;
    mkdtempSync(prefix: string): string;
    mkdtemp(prefix: string, callback: (err: Error | null, directory?: string) => void): void;
    rmSync(path: string, options?: {
        recursive?: boolean;
        force?: boolean;
    }): void;
    cpSync(src: string, dest: string, options?: {
        recursive?: boolean;
        force?: boolean;
    }): void;
    watch(filename: string, options?: {
        persistent?: boolean;
        recursive?: boolean;
    }, listener?: WatchListener): FSWatcher;
    watch(filename: string, listener?: WatchListener): FSWatcher;
    readFile(path: string, callback: (err: Error | null, data?: Uint8Array) => void): void;
    readFile(path: string, options: string, callback: (err: Error | null, data?: string | Uint8Array) => void): void;
    readFile(path: string, options: {
        encoding: string;
    }, callback: (err: Error | null, data?: string) => void): void;
    writeFile(path: string, data: string | Uint8Array, callback: (err: Error | null) => void): void;
    writeFile(path: string, data: string | Uint8Array, options: {
        encoding?: string;
        mode?: number;
        flag?: string;
    }, callback: (err: Error | null) => void): void;
    appendFile(path: string, data: string | Uint8Array, callback: (err: Error | null) => void): void;
    appendFile(path: string, data: string | Uint8Array, options: {
        encoding?: string;
        mode?: number;
        flag?: string;
    }, callback: (err: Error | null) => void): void;
    stat(path: string, callback: (err: Error | null, stats?: Stats) => void): void;
    stat(path: string, options: unknown, callback: (err: Error | null, stats?: Stats) => void): void;
    lstat(path: string, callback: (err: Error | null, stats?: Stats) => void): void;
    lstat(path: string, options: unknown, callback: (err: Error | null, stats?: Stats) => void): void;
    fstat(fd: number, callback: (err: Error | null, stats?: Stats) => void): void;
    open(path: PathLike, flags: string | number, mode: number | undefined, callback: (err: Error | null, fd?: number) => void): void;
    close(fd: number, callback: (err: Error | null) => void): void;
    read(fd: number, buffer: Buffer | Uint8Array, offset: number, length: number, position: number | null, callback: (err: Error | null, bytesRead?: number, buffer?: Buffer | Uint8Array) => void): void;
    write(fd: number, buffer: Buffer | Uint8Array | string, offset?: number | null, length?: number | null, position?: number | null, callback?: (err: Error | null, bytesWritten?: number, buffer?: Buffer | Uint8Array | string) => void): void;
    readdir(path: string, callback: (err: Error | null, files?: string[]) => void): void;
    mkdir(path: string, callback: (err: Error | null) => void): void;
    mkdir(path: string, options: {
        recursive?: boolean;
        mode?: number;
    }, callback: (err: Error | null) => void): void;
    unlink(path: string, callback: (err: Error | null) => void): void;
    rmdir(path: string, callback: (err: Error | null) => void): void;
    rename(oldPath: string, newPath: string, callback: (err: Error | null) => void): void;
    copyFile(src: string, dest: string, callback: (err: Error | null) => void): void;
    link(existingPath: string, newPath: string, callback: (err: Error | null) => void): void;
    symlink(target: string, path: string, callback: (err: Error | null) => void): void;
    symlink(target: string, path: string, type: string, callback: (err: Error | null) => void): void;
    readlink(path: string, callback: (err: Error | null, linkString?: string) => void): void;
    rm(path: string, callback: (err: Error | null) => void): void;
    rm(path: string, options: {
        recursive?: boolean;
        force?: boolean;
    }, callback: (err: Error | null) => void): void;
    cp(src: string, dest: string, callback: (err: Error | null) => void): void;
    cp(src: string, dest: string, options: {
        recursive?: boolean;
        force?: boolean;
    }, callback: (err: Error | null) => void): void;
    realpath(path: string, callback: (err: Error | null, resolvedPath?: string) => void): void;
    realpath(path: string, options: unknown, callback: (err: Error | null, resolvedPath?: string) => void): void;
    access(path: string, callback: (err: Error | null) => void): void;
    access(path: string, mode: number, callback: (err: Error | null) => void): void;
    truncate(path: string, callback: (err: Error | null) => void): void;
    truncate(path: string, len: number, callback: (err: Error | null) => void): void;
    utimes(path: string, atime: TimeLike, mtime: TimeLike, callback: (err: Error | null) => void): void;
    chmod(path: string, mode: number, callback: (err: Error | null) => void): void;
    chown(path: string, uid: number, gid: number, callback: (err: Error | null) => void): void;
    watchFile(filename: string, listener: StatWatcherListener): void;
    watchFile(filename: string, options: unknown, listener: StatWatcherListener): void;
    unwatchFile(filename: string, listener?: StatWatcherListener): void;
    createReadStream(path: string): unknown;
    createWriteStream(path: string): unknown;
    promises: FsPromises;
    constants: FsConstants;
}
export interface FsPromises {
    constants: FsConstants;
    readFile(path: PathLike): Promise<Buffer>;
    readFile(path: PathLike, encoding: 'utf8' | 'utf-8'): Promise<string>;
    readFile(path: PathLike, options: {
        encoding: 'utf8' | 'utf-8';
    }): Promise<string>;
    open(path: PathLike, flags?: string | number, mode?: number): Promise<FileHandle>;
    appendFile(path: PathLike, data: string | Uint8Array): Promise<void>;
    writeFile(path: PathLike, data: string | Uint8Array): Promise<void>;
    stat(path: PathLike): Promise<Stats>;
    lstat(path: PathLike): Promise<Stats>;
    readdir(path: PathLike): Promise<string[]>;
    mkdir(path: PathLike, options?: {
        recursive?: boolean;
    }): Promise<void>;
    unlink(path: PathLike): Promise<void>;
    rmdir(path: PathLike): Promise<void>;
    rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
    rm(path: PathLike, options?: {
        recursive?: boolean;
        force?: boolean;
    }): Promise<void>;
    mkdtemp(prefix: string): Promise<string>;
    access(path: PathLike, mode?: number): Promise<void>;
    truncate(path: PathLike, len?: number): Promise<void>;
    realpath(path: PathLike): Promise<string>;
    copyFile(src: PathLike, dest: PathLike): Promise<void>;
    cp(src: PathLike, dest: PathLike, options?: {
        recursive?: boolean;
        force?: boolean;
    }): Promise<void>;
    link(existingPath: PathLike, newPath: PathLike): Promise<void>;
    symlink(target: PathLike, path: PathLike, type?: string): Promise<void>;
    readlink(path: PathLike): Promise<string>;
    utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<void>;
    chmod(path: PathLike, mode: number): Promise<void>;
    chown(path: PathLike, uid: number, gid: number): Promise<void>;
}
export interface FileHandle {
    readonly fd: number;
    stat(): Promise<Stats>;
    read<T extends Buffer | Uint8Array>(buffer: T, offset?: number, length?: number, position?: number | null): Promise<{
        bytesRead: number;
        buffer: T;
    }>;
    appendFile(data: string | Uint8Array): Promise<void>;
    writeFile(data: string | Uint8Array): Promise<void>;
    close(): Promise<void>;
    [Symbol.asyncDispose](): Promise<void>;
    [Symbol.dispose](): void;
}
export interface FsConstants {
    F_OK: number;
    R_OK: number;
    W_OK: number;
    X_OK: number;
    O_RDONLY: number;
    O_WRONLY: number;
    O_RDWR: number;
    O_CREAT: number;
    O_EXCL: number;
    O_TRUNC: number;
    O_APPEND: number;
    O_NOFOLLOW: number;
}
/**
 * Dirent class - represents a directory entry returned by readdirSync with withFileTypes: true
 */
export declare class Dirent {
    name: string;
    private _isDirectory;
    private _isFile;
    constructor(name: string, isDirectory: boolean, isFile: boolean);
    isDirectory(): boolean;
    isFile(): boolean;
    isBlockDevice(): boolean;
    isCharacterDevice(): boolean;
    isFIFO(): boolean;
    isSocket(): boolean;
    isSymbolicLink(): boolean;
}
export declare function dupFdSync(fd: number): number;
export declare function closeFdSync(fd: number): void;
export declare function writeToFdSync(fd: number, buffer: Buffer | Uint8Array | string, offset?: number, length?: number, position?: number | null): number;
export declare function writeFileDescriptorSync(fd: number, data: string | Uint8Array): void;
export declare function truncateFdSync(fd: number, len?: number): void;
export interface FsShimStdio {
    writeStdout?: (data: Uint8Array) => void;
    writeStderr?: (data: Uint8Array) => void;
}
export declare function createFsShim(vfs: VirtualFS, getCwd?: () => string, stdio?: FsShimStdio): FsShim;
export default createFsShim;
//# sourceMappingURL=fs.d.ts.map