import { EventEmitter } from 'events';
import { Dirent as NodeDirent, ReadStream } from 'fs';
import { Stats as NodeStats, WriteStream } from 'fs';
import { NoParamCallback, BigIntStats as NodeBigIntStats } from 'fs';
import { LinkStrategy } from './algorithms/copyPromise';
import { FSPath, Path, PortablePath, PathUtils, Filename } from './path';
export type BufferEncodingOrBuffer = BufferEncoding | `buffer`;
export type Stats = NodeStats & {
    crc?: number;
};
export type BigIntStats = NodeBigIntStats & {
    crc?: number;
};
export type Dirent<T extends Path> = Omit<NodeDirent, `name` | `path` | `parentPath`> & {
    name: Filename;
    /** @deprecated */
    path: T;
    parentPath: T;
};
export type DirentNoPath = Omit<NodeDirent, `name` | `path` | `parentPath`> & {
    name: Filename;
};
export type Dir<P extends Path> = {
    readonly path: P;
    [Symbol.asyncIterator](): AsyncIterableIterator<DirentNoPath>;
    close(): Promise<void>;
    close(cb: NoParamCallback): void;
    closeSync(): void;
    read(): Promise<DirentNoPath | null>;
    read(cb: (err: NodeJS.ErrnoException | null, dirent: DirentNoPath | null) => void): void;
    readSync(): DirentNoPath | null;
};
export type OpendirOptions = Partial<{
    bufferSize: number;
    recursive: boolean;
}>;
export type ReaddirOptions = Partial<{
    recursive: boolean;
    withFileTypes: boolean;
}>;
export type CreateReadStreamOptions = Partial<{
    encoding: BufferEncoding;
    fd: number;
}>;
export type CreateWriteStreamOptions = Partial<{
    encoding: BufferEncoding;
    fd: number;
    flags: `a`;
}>;
export type MkdirOptions = Partial<{
    recursive: boolean;
    mode: number;
}>;
export type RmdirOptions = Partial<{
    maxRetries: number;
    retryDelay: number;
    /** @deprecated Use `rm` instead of `rmdir` */
    recursive: boolean;
}>;
export type RmOptions = Partial<{
    maxRetries: number;
    retryDelay: number;
    force: boolean;
    recursive: boolean;
}>;
export type WriteFileOptions = Partial<{
    encoding: BufferEncoding;
    mode: number;
    flag: string;
}> | BufferEncoding;
export type WatchOptions = Partial<{
    persistent: boolean;
    recursive: boolean;
    encoding: BufferEncodingOrBuffer;
}> | BufferEncodingOrBuffer;
export type WatchFileOptions = Partial<{
    bigint: boolean;
    persistent: boolean;
    interval: number;
}>;
export type ChangeFileOptions = Partial<{
    automaticNewlines: boolean;
    mode: number;
}>;
export type WatchCallback = (eventType: string, filename: string) => void;
export type Watcher = {
    on: any;
    close: () => void;
};
export type WatchFileCallback = (current: Stats, previous: Stats) => void;
export type StatWatcher = EventEmitter & {
    ref: () => StatWatcher;
    unref: () => StatWatcher;
};
export type ExtractHintOptions = {
    relevantExtensions: Set<string>;
};
export type SymlinkType = `file` | `dir` | `junction`;
export interface StatOptions {
    bigint?: boolean | undefined;
}
export interface StatSyncOptions extends StatOptions {
    throwIfNoEntry?: boolean | undefined;
}
export declare abstract class FakeFS<P extends Path> {
    readonly pathUtils: PathUtils<P>;
    protected constructor(pathUtils: PathUtils<P>);
    /**
     * @deprecated: Moved to jsInstallUtils
     */
    abstract getExtractHint(hints: ExtractHintOptions): boolean;
    abstract getRealPath(): P;
    abstract resolve(p: P): P;
    abstract opendirPromise(p: P, opts?: OpendirOptions): Promise<Dir<P>>;
    abstract opendirSync(p: P, opts?: OpendirOptions): Dir<P>;
    abstract openPromise(p: P, flags: string, mode?: number): Promise<number>;
    abstract openSync(p: P, flags: string, mode?: number): number;
    abstract readPromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number | null): Promise<number>;
    abstract readSync(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number | null): number;
    abstract writePromise(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): Promise<number>;
    abstract writePromise(fd: number, buffer: string, position?: number): Promise<number>;
    abstract writeSync(fd: number, buffer: Buffer, offset?: number, length?: number, position?: number): number;
    abstract writeSync(fd: number, buffer: string, position?: number): number;
    abstract closePromise(fd: number): Promise<void>;
    abstract closeSync(fd: number): void;
    abstract createWriteStream(p: P | null, opts?: CreateWriteStreamOptions): WriteStream;
    abstract createReadStream(p: P | null, opts?: CreateReadStreamOptions): ReadStream;
    abstract realpathPromise(p: P): Promise<P>;
    abstract realpathSync(p: P): P;
    abstract readdirPromise(p: P, opts?: null): Promise<Array<Filename>>;
    abstract readdirPromise(p: P, opts: {
        recursive?: false;
        withFileTypes: true;
    }): Promise<Array<DirentNoPath>>;
    abstract readdirPromise(p: P, opts: {
        recursive?: false;
        withFileTypes?: false;
    }): Promise<Array<Filename>>;
    abstract readdirPromise(p: P, opts: {
        recursive?: false;
        withFileTypes: boolean;
    }): Promise<Array<DirentNoPath | Filename>>;
    abstract readdirPromise(p: P, opts: {
        recursive: true;
        withFileTypes: true;
    }): Promise<Array<Dirent<P>>>;
    abstract readdirPromise(p: P, opts: {
        recursive: true;
        withFileTypes?: false;
    }): Promise<Array<P>>;
    abstract readdirPromise(p: P, opts: {
        recursive: true;
        withFileTypes: boolean;
    }): Promise<Array<Dirent<P> | P>>;
    abstract readdirPromise(p: P, opts: {
        recursive: boolean;
        withFileTypes: true;
    }): Promise<Array<Dirent<P> | DirentNoPath>>;
    abstract readdirPromise(p: P, opts: {
        recursive: boolean;
        withFileTypes?: false;
    }): Promise<Array<P>>;
    abstract readdirPromise(p: P, opts: {
        recursive: boolean;
        withFileTypes: boolean;
    }): Promise<Array<Dirent<P> | DirentNoPath | P>>;
    abstract readdirPromise(p: P, opts?: ReaddirOptions | null): Promise<Array<Dirent<P> | DirentNoPath | P>>;
    abstract readdirSync(p: P, opts?: null): Array<Filename>;
    abstract readdirSync(p: P, opts: {
        recursive?: false;
        withFileTypes: true;
    }): Array<DirentNoPath>;
    abstract readdirSync(p: P, opts: {
        recursive?: false;
        withFileTypes?: false;
    }): Array<Filename>;
    abstract readdirSync(p: P, opts: {
        recursive?: false;
        withFileTypes: boolean;
    }): Array<DirentNoPath | Filename>;
    abstract readdirSync(p: P, opts: {
        recursive: true;
        withFileTypes: true;
    }): Array<Dirent<P>>;
    abstract readdirSync(p: P, opts: {
        recursive: true;
        withFileTypes?: false;
    }): Array<P>;
    abstract readdirSync(p: P, opts: {
        recursive: true;
        withFileTypes: boolean;
    }): Array<Dirent<P> | P>;
    abstract readdirSync(p: P, opts: {
        recursive: boolean;
        withFileTypes: true;
    }): Array<Dirent<P> | DirentNoPath>;
    abstract readdirSync(p: P, opts: {
        recursive: boolean;
        withFileTypes?: false;
    }): Array<P>;
    abstract readdirSync(p: P, opts: {
        recursive: boolean;
        withFileTypes: boolean;
    }): Array<Dirent<P> | DirentNoPath | P>;
    abstract readdirSync(p: P, opts?: ReaddirOptions | null): Array<Dirent<P> | DirentNoPath | P>;
    abstract existsPromise(p: P): Promise<boolean>;
    abstract existsSync(p: P): boolean;
    abstract accessPromise(p: P, mode?: number): Promise<void>;
    abstract accessSync(p: P, mode?: number): void;
    abstract statPromise(p: P): Promise<Stats>;
    abstract statPromise(p: P, opts: (StatOptions & {
        bigint?: false | undefined;
    }) | undefined): Promise<Stats>;
    abstract statPromise(p: P, opts: StatOptions & {
        bigint: true;
    }): Promise<BigIntStats>;
    abstract statPromise(p: P, opts?: StatOptions): Promise<Stats | BigIntStats>;
    abstract statSync(p: P): Stats;
    abstract statSync(p: P, opts?: StatSyncOptions & {
        bigint?: false | undefined;
        throwIfNoEntry: false;
    }): Stats | undefined;
    abstract statSync(p: P, opts: StatSyncOptions & {
        bigint: true;
        throwIfNoEntry: false;
    }): BigIntStats | undefined;
    abstract statSync(p: P, opts?: StatSyncOptions & {
        bigint?: false | undefined;
    }): Stats;
    abstract statSync(p: P, opts: StatSyncOptions & {
        bigint: true;
    }): BigIntStats;
    abstract statSync(p: P, opts: StatSyncOptions & {
        bigint: boolean;
        throwIfNoEntry?: false | undefined;
    }): Stats | BigIntStats;
    abstract statSync(p: P, opts?: StatSyncOptions): Stats | BigIntStats | undefined;
    abstract fstatPromise(fd: number): Promise<Stats>;
    abstract fstatPromise(fd: number, opts: {
        bigint: true;
    }): Promise<BigIntStats>;
    abstract fstatPromise(fd: number, opts?: {
        bigint?: boolean;
    }): Promise<BigIntStats | Stats>;
    abstract fstatSync(fd: number): Stats;
    abstract fstatSync(fd: number, opts: {
        bigint: true;
    }): BigIntStats;
    abstract fstatSync(fd: number, opts?: {
        bigint?: boolean;
    }): BigIntStats | Stats;
    abstract lstatPromise(p: P): Promise<Stats>;
    abstract lstatPromise(p: P, opts: (StatOptions & {
        bigint?: false | undefined;
    }) | undefined): Promise<Stats>;
    abstract lstatPromise(p: P, opts: StatOptions & {
        bigint: true;
    }): Promise<BigIntStats>;
    abstract lstatPromise(p: P, opts?: StatOptions): Promise<Stats | BigIntStats>;
    abstract lstatSync(p: P): Stats;
    abstract lstatSync(p: P, opts?: StatSyncOptions & {
        bigint?: false | undefined;
        throwIfNoEntry: false;
    }): Stats | undefined;
    abstract lstatSync(p: P, opts: StatSyncOptions & {
        bigint: true;
        throwIfNoEntry: false;
    }): BigIntStats | undefined;
    abstract lstatSync(p: P, opts?: StatSyncOptions & {
        bigint?: false | undefined;
    }): Stats;
    abstract lstatSync(p: P, opts: StatSyncOptions & {
        bigint: true;
    }): BigIntStats;
    abstract lstatSync(p: P, opts: StatSyncOptions & {
        bigint: boolean;
        throwIfNoEntry?: false | undefined;
    }): Stats | BigIntStats;
    abstract lstatSync(p: P, opts?: StatSyncOptions): Stats | BigIntStats | undefined;
    abstract chmodPromise(p: P, mask: number): Promise<void>;
    abstract chmodSync(p: P, mask: number): void;
    abstract fchmodPromise(fd: number, mask: number): Promise<void>;
    abstract fchmodSync(fd: number, mask: number): void;
    abstract fchownPromise(fd: number, uid: number, gid: number): Promise<void>;
    abstract fchownSync(fd: number, uid: number, gid: number): void;
    abstract chownPromise(p: P, uid: number, gid: number): Promise<void>;
    abstract chownSync(p: P, uid: number, gid: number): void;
    abstract mkdirPromise(p: P, opts?: MkdirOptions): Promise<string | undefined>;
    abstract mkdirSync(p: P, opts?: MkdirOptions): string | undefined;
    abstract rmdirPromise(p: P, opts?: RmdirOptions): Promise<void>;
    abstract rmdirSync(p: P, opts?: RmdirOptions): void;
    abstract rmPromise(p: P, opts?: RmOptions): Promise<void>;
    abstract rmSync(p: P, opts?: RmOptions): void;
    abstract linkPromise(existingP: P, newP: P): Promise<void>;
    abstract linkSync(existingP: P, newP: P): void;
    abstract symlinkPromise(target: P, p: P, type?: SymlinkType): Promise<void>;
    abstract symlinkSync(target: P, p: P, type?: SymlinkType): void;
    abstract renamePromise(oldP: P, newP: P): Promise<void>;
    abstract renameSync(oldP: P, newP: P): void;
    abstract copyFilePromise(sourceP: P, destP: P, flags?: number): Promise<void>;
    abstract copyFileSync(sourceP: P, destP: P, flags?: number): void;
    abstract appendFilePromise(p: FSPath<P>, content: string | Uint8Array, opts?: WriteFileOptions): Promise<void>;
    abstract appendFileSync(p: FSPath<P>, content: string | Uint8Array, opts?: WriteFileOptions): void;
    abstract writeFilePromise(p: FSPath<P>, content: string | NodeJS.ArrayBufferView, opts?: WriteFileOptions): Promise<void>;
    abstract writeFileSync(p: FSPath<P>, content: string | NodeJS.ArrayBufferView, opts?: WriteFileOptions): void;
    abstract unlinkPromise(p: P): Promise<void>;
    abstract unlinkSync(p: P): void;
    abstract utimesPromise(p: P, atime: Date | string | number, mtime: Date | string | number): Promise<void>;
    abstract utimesSync(p: P, atime: Date | string | number, mtime: Date | string | number): void;
    abstract lutimesPromise(p: P, atime: Date | string | number, mtime: Date | string | number): Promise<void>;
    abstract lutimesSync(p: P, atime: Date | string | number, mtime: Date | string | number): void;
    abstract readFilePromise(p: FSPath<P>, encoding?: null): Promise<NonSharedBuffer>;
    abstract readFilePromise(p: FSPath<P>, encoding: BufferEncoding): Promise<string>;
    abstract readFilePromise(p: FSPath<P>, encoding?: BufferEncoding | null): Promise<NonSharedBuffer | string>;
    abstract readFileSync(p: FSPath<P>, encoding?: null): NonSharedBuffer;
    abstract readFileSync(p: FSPath<P>, encoding: BufferEncoding): string;
    abstract readFileSync(p: FSPath<P>, encoding?: BufferEncoding | null): NonSharedBuffer | string;
    abstract readlinkPromise(p: P): Promise<P>;
    abstract readlinkSync(p: P): P;
    abstract ftruncatePromise(fd: number, len?: number): Promise<void>;
    abstract ftruncateSync(fd: number, len?: number): void;
    abstract truncatePromise(p: P, len?: number): Promise<void>;
    abstract truncateSync(p: P, len?: number): void;
    abstract watch(p: P, cb?: WatchCallback): Watcher;
    abstract watch(p: P, opts: WatchOptions, cb?: WatchCallback): Watcher;
    abstract watchFile(p: P, cb: WatchFileCallback): StatWatcher;
    abstract watchFile(p: P, opts: WatchFileOptions, cb: WatchFileCallback): StatWatcher;
    abstract unwatchFile(p: P, cb?: WatchFileCallback): void;
    genTraversePromise(init: P, { stableSort }?: {
        stableSort?: boolean;
    }): AsyncGenerator<P, void, unknown>;
    checksumFilePromise(path: P, { algorithm }?: {
        algorithm?: string;
    }): Promise<string>;
    removePromise(p: P, { recursive, maxRetries }?: {
        recursive?: boolean;
        maxRetries?: number;
    }): Promise<void>;
    removeSync(p: P, { recursive }?: {
        recursive?: boolean;
    }): void;
    mkdirpPromise(p: P, { chmod, utimes }?: {
        chmod?: number;
        utimes?: [Date | string | number, Date | string | number];
    }): Promise<string | undefined>;
    mkdirpSync(p: P, { chmod, utimes }?: {
        chmod?: number;
        utimes?: [Date | string | number, Date | string | number];
    }): string | undefined;
    copyPromise(destination: P, source: P, options?: {
        baseFs?: undefined;
        overwrite?: boolean;
        stableSort?: boolean;
        stableTime?: boolean;
        linkStrategy?: LinkStrategy<P> | null;
    }): Promise<void>;
    copyPromise<P2 extends Path>(destination: P, source: P2, options: {
        baseFs: FakeFS<P2>;
        overwrite?: boolean;
        stableSort?: boolean;
        stableTime?: boolean;
        linkStrategy?: LinkStrategy<P> | null;
    }): Promise<void>;
    /** @deprecated Prefer using `copyPromise` instead */
    copySync(destination: P, source: P, options?: {
        baseFs?: undefined;
        overwrite?: boolean;
    }): void;
    copySync<P2 extends Path>(destination: P, source: P2, options: {
        baseFs: FakeFS<P2>;
        overwrite?: boolean;
    }): void;
    changeFilePromise(p: P, content: Buffer): Promise<void>;
    changeFilePromise(p: P, content: string, opts?: ChangeFileOptions): Promise<void>;
    private changeFileBufferPromise;
    private changeFileTextPromise;
    changeFileSync(p: P, content: Buffer): void;
    changeFileSync(p: P, content: string, opts?: ChangeFileOptions): void;
    private changeFileBufferSync;
    private changeFileTextSync;
    movePromise(fromP: P, toP: P): Promise<void>;
    moveSync(fromP: P, toP: P): void;
    lockPromise<T>(affectedPath: P, callback: () => Promise<T>): Promise<T>;
    readJsonPromise(p: P): Promise<any>;
    readJsonSync(p: P): any;
    writeJsonPromise(p: P, data: any, { compact }?: {
        compact?: boolean;
    }): Promise<void>;
    writeJsonSync(p: P, data: any, { compact }?: {
        compact?: boolean;
    }): void;
    preserveTimePromise(p: P, cb: () => Promise<P | void>): Promise<void>;
    preserveTimeSync(p: P, cb: () => P | void): Promise<void>;
}
export declare abstract class BasePortableFakeFS extends FakeFS<PortablePath> {
    protected constructor();
}
export declare function normalizeLineEndings(originalContent: string, newContent: string): string;
