import { ResultAsync } from "neverthrow"; export declare class FileUtilsError extends Error { constructor(...args: ConstructorParameters); } export declare function isDir(dirPath: string): boolean; export declare function saveJson(json: unknown, filePath: string, appendJsonExtension?: boolean): ResultAsync; /** * Removes all files and subdirectories of `dirPath`, except for `exclude`. * @param dirPath Any absolute directory path * @param exclude Array of glob patterns to exclude (e.g. ['*.json', '** /*.csv', 'my-important-folder/**']). Glob patterns are relative to `dirPath`. */ export declare function removeFilesFromDir(dirPath: string, exclude?: string[]): ResultAsync; export declare function pad(num: number, size: number): string; export declare function removeDirIfEmpty(dirPath: string): ResultAsync; export declare function listDir(dirPath: string): ResultAsync; export declare function isDirEmpty(dirPath: string): ResultAsync; /** * Ensures that the directory exists. If the directory structure does not exist, it is created. */ export declare function ensureDir(dirPath: string): ResultAsync; /** * Removes a file or directory. The directory can have contents. If the path does not exist, silently does nothing. */ export declare function remove(dir: string): ResultAsync; /** * returns true if the path exists, false otherwise */ export declare function pathExists(dir: string): ResultAsync; /** * Copies a file or directory from `src` to `dest`. */ export declare function copy(src: string, dest: string, options?: { preserveTimestamps: boolean; }): ResultAsync; /** * Copies a file from `src` to `dest`. */ export declare function copyFile(src: string, dest: string): ResultAsync; /** * Replaces `dest` with `src` without deleting the published path before the replacement succeeds. * If `dest` already exists, it is first moved aside to a rollback path and restored if promotion fails. */ export declare function replacePath(src: string, dest: string, options?: { preserveTimestamps?: boolean; rollbackDir?: string; }): ResultAsync; /** * Clear files from a directory. * Optionally respects keep patterns and removes empty directories. */ export declare function clearDir(dirPath: string, options?: { keepPatterns?: string[]; ignoreKeep?: boolean; removeIfEmpty?: boolean; }): ResultAsync; /** * Clear directories and optionally remove parent if empty. */ export declare function clearDirs(dirPaths: string[], options?: { keepPatterns?: string[]; ignoreKeep?: boolean; removeIfEmpty?: boolean; }): ResultAsync; /** * Copies files from `srcDir` to `destDir` that match any of the provided glob patterns. * Patterns are evaluated relative to `srcDir`. */ export declare function copyMatchingFiles(srcDir: string, destDir: string, patterns?: string[]): ResultAsync; //# sourceMappingURL=file-utils.d.ts.map