/** * Filesystem interface for LightningFS * This interface provides a unified API for filesystem operations */ export interface JSRuntimeFS { // Core file operations with proper overloads for type safety readFile(path: string): Promise; readFile(path: string, encoding: 'utf8'): Promise; readFile(path: string, encoding: string): Promise; readFile(path: string, encoding?: string): Promise; writeFile(path: string, data: string | Uint8Array, encoding?: string): Promise; // readdir overloads for different return types readdir(path: string): Promise; readdir(path: string, options: { withFileTypes: true }): Promise; readdir(path: string, options?: { withFileTypes?: boolean }): Promise; mkdir(path: string, options?: { recursive?: boolean }): Promise; stat(path: string): Promise<{ isDirectory(): boolean; isFile(): boolean; size?: number; mtimeMs?: number; }>; lstat(path: string): Promise<{ isDirectory(): boolean; isFile(): boolean; size?: number; mtimeMs?: number; }>; // Additional operations that LightningFS supports unlink(path: string): Promise; rmdir(path: string): Promise; rename(oldPath: string, newPath: string): Promise; readlink(path: string): Promise; symlink(target: string, path: string): Promise; } /** * Directory entry with file type information */ export interface DirectoryEntry { name: string; isDirectory(): boolean; isFile(): boolean; }