/** * @fractary/core - File Manager * * Unified interface for file storage operations. * Supports multiple storage backends: local, S3, R2, GCS, Google Drive. */ import { Storage, FileManagerConfig, StorageConfig } from './types'; /** * Extended configuration options for FileManager */ export interface FileManagerOptions extends FileManagerConfig { /** * Storage configuration for automatic backend selection * If provided, this takes precedence over storage and basePath */ storageConfig?: StorageConfig; } /** * File Manager - Unified interface for file operations * * Provides a consistent API for file operations across different storage backends. * Supports local filesystem, AWS S3, Cloudflare R2, Google Cloud Storage, * and Google Drive. * * @example * // Local storage (default) * const localManager = new FileManager({ basePath: '.fractary/files' }); * * @example * // S3 storage with configuration * const s3Manager = new FileManager({ * storageConfig: { * type: 's3', * bucket: 'my-bucket', * region: 'us-east-1', * prefix: 'files/', * auth: { profile: 'default' } * } * }); * * @example * // Custom storage backend * const customManager = new FileManager({ * storage: myCustomStorage * }); */ export declare class FileManager { private storage; constructor(config?: FileManagerOptions); /** * Validate a file path for security issues * * @param path - Path to validate * @throws Error if path is invalid or contains security issues */ private validatePath; /** * Write file content * * @param path - Path/identifier for the file * @param content - Content to write * @returns URI or path where the content was written */ write(path: string, content: string | Buffer): Promise; /** * Read file content * * @param path - Path/identifier for the file * @returns File content or null if not found */ read(path: string): Promise; /** * Check if file exists * * @param path - Path/identifier for the file * @returns True if the file exists */ exists(path: string): Promise; /** * List files (optionally with prefix) * * @param prefix - Optional prefix to filter results * @returns List of file paths/identifiers */ list(prefix?: string): Promise; /** * Delete file * * @param path - Path/identifier for the file */ delete(path: string): Promise; /** * Copy file from one location to another * * @param sourcePath - Source path/identifier * @param destPath - Destination path/identifier * @returns URI or path where the content was copied */ copy(sourcePath: string, destPath: string): Promise; /** * Move file from one location to another * * @param sourcePath - Source path/identifier * @param destPath - Destination path/identifier * @returns URI or path where the content was moved */ move(sourcePath: string, destPath: string): Promise; /** * Get a URL for the file (if supported by the storage backend) * * @param path - Path/identifier for the file * @param expiresIn - Expiration time in seconds (for presigned URLs) * @returns URL or null if not supported */ getUrl(path: string, expiresIn?: number): Promise; /** * Get the underlying storage backend * * @returns The storage instance */ getStorage(): Storage; } //# sourceMappingURL=manager.d.ts.map