declare module 'fs' { import type { Readable, Writable } from 'stream'; interface Stats { size: number; mode: number; uid: number; gid: number; isFile(): boolean; isDirectory(): boolean; isSymbolicLink(): boolean; } type Encoding = 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'latin1' | 'binary' | 'base64' | 'base64url' | 'hex' | 'ascii'; type WatchEventType = 'rename' | 'change'; interface FSWatcher { close(): this; ref(): this; unref(): this; on(event: 'change', listener: (eventType: WatchEventType, filename?: string) => void): this; on(event: 'error', listener: (error: Error) => void): this; } interface WatchOptions { persistent?: boolean; recursive?: boolean; encoding?: Encoding | 'buffer'; } interface WatchFileOptions { persistent?: boolean; interval?: number; } interface ReadStream extends Readable { readonly path: string; readonly bytesRead: number; readonly pending: boolean; readonly closed: boolean; readonly fd?: number | null; close(callback?: () => void): this; } interface WriteStream extends Writable { readonly path: string; readonly bytesWritten: number; readonly pending: boolean; readonly closed: boolean; readonly fd?: number | null; close(callback?: () => void): this; } const constants: { 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; }; const promises: typeof import('fs/promises'); function readFile(path: string, encoding: Encoding): Promise; function readFile(path: string): Promise; function readFileSync(path: string, encoding: Encoding | { encoding: Encoding }): string; function readFileSync(path: string): Uint8Array; function read( fd: number, buffer: ArrayBufferView, offset?: number, length?: number, position?: number | null, callback?: (err: Error | null, bytesRead: number, buffer: ArrayBufferView) => void ): Promise; function readSync(fd: number, buffer: ArrayBufferView, offset?: number, length?: number, position?: number | null): number; function stream(path: string): Promise; function createReadStream( path: string, options?: { fd?: number; flags?: string | number; mode?: number; start?: number; end?: number; autoClose?: boolean; emitClose?: boolean; highWaterMark?: number; } ): ReadStream; function createWriteStream( path: string, options?: { fd?: number; flags?: string | number; mode?: number; start?: number; autoClose?: boolean; emitClose?: boolean; highWaterMark?: number; } ): WriteStream; function open(path: string, flags?: string, mode?: number): Promise; function openSync(path: string, flags?: string, mode?: number): number; function close(fd: number): Promise; function closeSync(fd: number): void; function writeFile(path: string, data: string | ArrayBufferView): Promise; function writeFileSync(path: string, data: string | ArrayBufferView): void; function write(fd: number, data: string | ArrayBufferView, offset?: number, length?: number, position?: number | null): Promise; function writeSync(fd: number, data: string | ArrayBufferView, offset?: number, length?: number, position?: number | null): number; function writev(fd: number, buffers: ArrayBufferView[], position?: number): Promise; function writevSync(fd: number, buffers: ArrayBufferView[], position?: number): number; function appendFileSync(path: string, data: string): void; function copyFileSync(src: string, dest: string): void; function renameSync(oldPath: string, newPath: string): void; function rm(path: string, options?: { recursive?: boolean; force?: boolean }): Promise; function unlink(path: string): Promise; function rmSync(path: string, options?: { recursive?: boolean; force?: boolean }): void; function unlinkSync(path: string): void; function mkdir(path: string, options?: { recursive?: boolean; mode?: number }): Promise; function mkdirSync(path: string, options?: number | { recursive?: boolean; mode?: number }): void; function mkdtemp(prefix: string): Promise; function mkdtempSync(prefix: string): string; function rmdir(path: string): Promise; function rmdirSync(path: string): void; function stat(path: string): Promise; function statSync(path: string): Stats; function exists(path: string): Promise; function existsSync(path: string): boolean; function access(path: string, mode?: number): Promise; function accessSync(path: string, mode?: number): void; function readdir(path: string): Promise; function readdirSync(path: string): string[]; function realpath(path: string): Promise; function realpathSync(path: string): string; namespace realpathSync { function native(path: string): string; } function watch(path: string, listener?: (eventType: WatchEventType, filename?: string) => void): FSWatcher; function watch( path: string, options: WatchOptions | Encoding | 'buffer', listener?: (eventType: WatchEventType, filename?: string) => void ): FSWatcher; function watchFile(path: string, listener: (curr: Stats, prev: Stats) => void): void; function watchFile(path: string, options: WatchFileOptions, listener: (curr: Stats, prev: Stats) => void): void; function unwatchFile(path: string, listener?: (curr: Stats, prev: Stats) => void): void; const FSWatcher: { prototype: FSWatcher; }; const ReadStream: { prototype: ReadStream; new ( path: string, options?: { fd?: number; flags?: string | number; mode?: number; start?: number; end?: number; autoClose?: boolean; emitClose?: boolean; highWaterMark?: number; } ): ReadStream; }; const WriteStream: { prototype: WriteStream; new ( path: string, options?: { fd?: number; flags?: string | number; mode?: number; start?: number; autoClose?: boolean; emitClose?: boolean; highWaterMark?: number; } ): WriteStream; }; } declare module 'ant:fs' { export * from 'fs'; } declare module 'node:fs' { export * from 'fs'; } declare module 'fs/promises' { interface Stats { size: number; mode: number; uid: number; gid: number; isFile(): boolean; isDirectory(): boolean; isSymbolicLink(): boolean; } type Encoding = 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'latin1' | 'binary' | 'base64' | 'base64url' | 'hex' | 'ascii'; const constants: { 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; }; function readFile(path: string, encoding: Encoding): Promise; function readFile(path: string): Promise; function open(path: string, flags?: string, mode?: number): Promise; function close(fd: number): Promise; function writeFile(path: string, data: string | ArrayBufferView): Promise; function write(fd: number, data: string | ArrayBufferView, offset?: number, length?: number, position?: number | null): Promise; function writev(fd: number, buffers: ArrayBufferView[], position?: number): Promise; function rm(path: string, options?: { recursive?: boolean; force?: boolean }): Promise; function unlink(path: string): Promise; function mkdir(path: string, options?: { recursive?: boolean; mode?: number }): Promise; function rmdir(path: string): Promise; function stat(path: string): Promise; function exists(path: string): Promise; function access(path: string, mode?: number): Promise; function readdir(path: string): Promise; function realpath(path: string): Promise; } declare module 'ant:fs/promises' { export * from 'fs/promises'; } declare module 'node:fs/promises' { export * from 'fs/promises'; }