/** * Safe file system operations. * - Atomic writes (write to temp, then rename) with symlink protection * - Symlink detection * - Safe copy with optional backup */ /** * Check if a path is a symlink. */ export declare function isSymlink(filePath: string): Promise; /** * Check if a file exists (follows symlinks). */ export declare function fileExists(filePath: string): Promise; /** * Check if a file exists and is NOT a symlink. * Use this for security-critical paths where symlink following is dangerous. */ export declare function fileExistsStrict(filePath: string): Promise; /** * Check if a directory exists. */ export declare function dirExists(dirPath: string): Promise; /** * Get file size in bytes. Returns 0 if file doesn't exist. */ export declare function getFileSize(filePath: string): Promise; /** * Get file modification time. Returns null if file doesn't exist. */ export declare function getFileMtime(filePath: string): Promise; /** * Ensure a directory exists, creating it recursively if needed. * Rejects symlinks for security. */ export declare function ensureDir(dirPath: string): Promise; /** * Atomically write content to a file. * Writes to a temp file in the same directory, then renames. * This prevents partial writes / corruption. * Rejects if the target path is a symlink (prevents symlink attacks). */ export declare function atomicWrite(filePath: string, content: string): Promise; /** * Read a file's contents. Returns null if file doesn't exist. */ export declare function readFileSafe(filePath: string): Promise; /** * Copy a file with an optional backup of the destination. * Rejects symlinks at both source and destination for security. */ export declare function safeCopy(source: string, destination: string, options?: { backup?: boolean; backupDir?: string; }): Promise; /** * Remove a file if it exists. */ export declare function removeFile(filePath: string): Promise; /** * List files in a directory matching an optional extension filter. */ export declare function listFiles(dirPath: string, extension?: string): Promise;