import fs from 'fs-extra'; /** * Utility class for file operations * * Provides methods for common file system operations with proper error handling. */ export declare class FileUtils { /** * Ensures a directory exists, creating it if necessary * * @param dirPath - Path to the directory * @throws Error if directory creation fails */ static ensureDirectory(dirPath: string): Promise; /** * Checks if a file or directory exists * * @param filePath - Path to check * @returns True if the path exists, false otherwise */ static fileExists(filePath: string): Promise; /** * Reads a file's contents * * @param filePath - Path to the file * @returns The file contents as a string * @throws Error if file reading fails */ static readFile(filePath: string): Promise; /** * Writes content to a file atomically * * Uses a write-to-temp-then-rename pattern for atomic writes. * This prevents file corruption if the process crashes during write. * * @param filePath - Path to the file * @param content - Content to write * @throws Error if file writing fails */ static writeFile(filePath: string, content: string): Promise; /** * Appends content to a file using the OS append semantic. * * This avoids the read-modify-write pattern and is safe for * concurrent in-process appenders (each call is a single write * syscall at the current end of the file). * * @param filePath - Path to the file * @param content - Content to append * @throws Error if appending fails */ static appendFile(filePath: string, content: string): Promise; /** * Lists files in a directory * * @param dirPath - Path to the directory * @returns Array of file names * @throws Error if directory reading fails */ static listFiles(dirPath: string): Promise; /** * Gets file statistics * * @param filePath - Path to the file * @returns File statistics * @throws Error if stat operation fails */ static getFileStats(filePath: string): Promise; /** * Checks if a path is a directory * * @param dirPath - Path to check * @returns True if the path is a directory, false otherwise */ static isDirectory(dirPath: string): Promise; /** * Deletes a file or directory * * @param targetPath - Path to delete * @throws Error if deletion fails */ static delete(targetPath: string): Promise; /** * Copies a file or directory * * @param sourcePath - Source path * @param destPath - Destination path * @throws Error if copy operation fails */ static copy(sourcePath: string, destPath: string): Promise; /** * Joins path segments * * @param paths - Path segments to join * @returns Joined path */ static joinPath(...paths: string[]): string; /** * Deletes a file * * @param filePath - Path to the file to delete * @throws Error if file deletion fails */ static deleteFile(filePath: string): Promise; } //# sourceMappingURL=FileUtils.d.ts.map