qraft
Version:
A powerful CLI tool to qraft structured project setups from GitHub template repositories
66 lines • 3.05 kB
TypeScript
import * as fs from 'fs-extra';
import { FileOperationResult } from '../types';
/**
* FileOperations handles safe file copying with overwrite protection
*/
export declare class FileOperations {
/**
* Copy a single file with overwrite protection
* @param sourcePath Absolute path to source file
* @param destinationPath Absolute path to destination file
* @param force Whether to force overwrite existing files
* @returns Promise<FileOperationResult> Result of the operation
*/
copyFile(sourcePath: string, destinationPath: string, force?: boolean): Promise<FileOperationResult>;
/**
* Copy multiple files from a source directory to a destination directory
* @param sourceDir Absolute path to source directory
* @param destinationDir Absolute path to destination directory
* @param files Array of relative file paths to copy
* @param force Whether to force overwrite existing files
* @param excludePatterns Optional array of patterns to exclude
* @returns Promise<FileOperationResult[]> Results for each file operation
*/
copyFiles(sourceDir: string, destinationDir: string, files: string[], force?: boolean, excludePatterns?: string[]): Promise<FileOperationResult[]>;
/**
* Copy an entire directory structure with overwrite protection
* @param sourceDir Absolute path to source directory
* @param destinationDir Absolute path to destination directory
* @param force Whether to force overwrite existing files
* @param excludePatterns Optional array of patterns to exclude
* @returns Promise<FileOperationResult[]> Results for each file operation
*/
copyDirectory(sourceDir: string, destinationDir: string, force?: boolean, excludePatterns?: string[]): Promise<FileOperationResult[]>;
/**
* Check if a file exists at the given path
* @param filePath Path to check
* @returns Promise<boolean> True if file exists
*/
fileExists(filePath: string): Promise<boolean>;
/**
* Get file stats (size, modification time, etc.)
* @param filePath Path to the file
* @returns Promise<fs.Stats | null> File stats or null if file doesn't exist
*/
getFileStats(filePath: string): Promise<fs.Stats | null>;
/**
* Recursively get all files in a directory
* @param dirPath Directory path to scan
* @returns Promise<string[]> Array of absolute file paths
*/
private getAllFiles;
/**
* Check if a file should be excluded based on patterns
* @param filePath Relative file path
* @param excludePatterns Array of patterns to match against
* @returns boolean True if file should be excluded
*/
private shouldExcludeFile;
/**
* Create a backup of a file before overwriting
* @param filePath Path to the file to backup
* @returns Promise<string | null> Path to backup file or null if backup failed
*/
createBackup(filePath: string): Promise<string | null>;
}
//# sourceMappingURL=fileOperations.d.ts.map