/** * File system statistics and metadata. * * Provides comprehensive information about a file or directory including size, type, and timestamp * information. * * @category Utilities */ interface FileStats { path: string; size: number; isFile: boolean; isDirectory: boolean; modified: Date; created: Date; } /** * Configuration options for file copy operations. * * Controls behavior during file copying including overwrite handling, timestamp preservation, and * directory creation. * * @category Utilities */ interface CopyOptions { overwrite?: boolean; preserveTimestamps?: boolean; createDirectories?: boolean; } /** * Configuration options for file move operations. * * Extends copy options with move-specific features like backup creation. Move operations are * typically implemented as copy-then-delete. * * @category Utilities */ interface MoveOptions extends CopyOptions { backup?: boolean; } /** Check if a file or directory exists */ declare function exists(path: string): Promise; /** Check if a path is readable */ declare function isReadable(path: string): Promise; /** Check if a path is writable */ declare function isWritable(path: string): Promise; /** Get file statistics */ declare function getStats(path: string): Promise; /** Ensure directory exists, creating it if necessary */ declare function ensureDirectory(dirPath: string): Promise; /** Safely read a file with encoding detection */ declare function readTextFile(filePath: string): Promise; /** Safely write a file with directory creation */ declare function writeTextFile(filePath: string, content: string, options?: { createDirectories?: boolean; }): Promise; /** Copy a file with options */ declare function copyFile(sourcePath: string, destinationPath: string, options?: CopyOptions): Promise; /** Move a file with options */ declare function moveFile(sourcePath: string, destinationPath: string, options?: MoveOptions): Promise; /** Delete a file safely */ declare function deleteFile(filePath: string): Promise; /** List files in a directory with filtering */ declare function listFiles(dirPath: string, options?: { recursive?: boolean; extensions?: string[]; includeDirectories?: boolean; }): Promise; /** Find markdown files in a directory */ declare function findMarkdownFiles(dirPath: string, recursive?: boolean): Promise; /** Create a backup of a file */ declare function createBackup(filePath: string, suffix?: string): Promise; /** Get file size in bytes */ declare function getFileSize(filePath: string): Promise; /** Check if two files have the same content */ declare function filesEqual(path1: string, path2: string): Promise; /** Generate a safe filename by removing invalid characters */ declare function sanitizeFilename(filename: string): string; /** Get relative path between two files */ declare function getRelativePath(fromFile: string, toFile: string): string; /** * Utility namespace for common file system operations. * * Provides a comprehensive set of functions for file and directory manipulation, with proper error * handling and cross-platform compatibility. All methods are async and use Node.js promises-based * file system APIs. * * @category Utilities * * @example * Basic file operations ```typescript // Check if file exists const exists = await FileUtils.exists('document.md'); * * // Read file content const content = await FileUtils.readTextFile('document.md'); * * // Write new content await FileUtils.writeTextFile('output.md', content, { createDirectories: true }); * * // Find markdown files const files = await FileUtils.findMarkdownFiles('./docs', true); ``` */ export declare const FileUtils: { exists: typeof exists; isReadable: typeof isReadable; isWritable: typeof isWritable; getStats: typeof getStats; ensureDirectory: typeof ensureDirectory; readTextFile: typeof readTextFile; writeTextFile: typeof writeTextFile; copyFile: typeof copyFile; moveFile: typeof moveFile; deleteFile: typeof deleteFile; listFiles: typeof listFiles; findMarkdownFiles: typeof findMarkdownFiles; createBackup: typeof createBackup; getFileSize: typeof getFileSize; filesEqual: typeof filesEqual; sanitizeFilename: typeof sanitizeFilename; getRelativePath: typeof getRelativePath; }; export {}; //# sourceMappingURL=file-utils.d.ts.map