/** * SMI-1308: File Streamer * * Memory-efficient file reading with streaming support for large files. * Provides generators for processing files without loading all into memory. * * @see docs/internal/architecture/multi-language-analysis.md * @module analysis/file-streamer */ /** * File content with metadata */ export interface FileContent { /** File path */ path: string; /** File content (may be truncated for large files) */ content: string; /** File size in bytes */ size: number; /** Number of lines */ lineCount: number; /** Whether content was truncated */ truncated?: boolean; } /** * Options for file streaming */ export interface StreamOptions { /** Maximum buffer size in bytes (default: 1MB) */ maxBufferSize?: number; /** Skip files larger than buffer (default: true) */ skipLargeFiles?: boolean; /** Include binary files (default: false) */ includeBinary?: boolean; } /** * Options for batch file reading */ export interface BatchReadOptions { /** Maximum concurrent reads (default: 10) */ concurrency?: number; /** Maximum file size to read (default: 1MB) */ maxFileSize?: number; /** Skip unreadable files (default: true) */ skipErrors?: boolean; } /** * Stream files with memory-efficient chunking * * Uses async generators to process files one at a time, * avoiding loading all file contents into memory. * * @param filePaths - Array of file paths to stream * @param options - Streaming options * @yields FileContent objects * * @example * ```typescript * for await (const file of streamFiles(paths, { maxBufferSize: 512 * 1024 })) { * console.log(`${file.path}: ${file.lineCount} lines`) * // Process file.content... * } * ``` */ export declare function streamFiles(filePaths: string[], options?: StreamOptions): AsyncGenerator; /** * Batch file reading with concurrency control * * Reads multiple files concurrently with a configurable limit * to balance speed and memory usage. * * @param filePaths - Array of file paths to read * @param options - Batch reading options * @returns Array of file contents * * @example * ```typescript * const files = await batchReadFiles(paths, { * concurrency: 20, * maxFileSize: 512 * 1024 * }) * * console.log(`Read ${files.length} files`) * ``` */ export declare function batchReadFiles(filePaths: string[], options?: BatchReadOptions): Promise; /** * Read files as a map for quick lookup * * @param filePaths - Array of file paths to read * @param options - Batch reading options * @returns Map of path to file content * * @example * ```typescript * const fileMap = await readFilesAsMap(paths) * const content = fileMap.get('src/index.ts') * ``` */ export declare function readFilesAsMap(filePaths: string[], options?: BatchReadOptions): Promise>; /** * Get file extension * * @param filePath - File path * @returns Extension including dot, or empty string */ export declare function getFileExtension(filePath: string): string; /** * Filter paths by extension * * @param filePaths - Array of file paths * @param extensions - Extensions to include (with dot) * @returns Filtered paths * * @example * ```typescript * const tsPaths = filterByExtension(allPaths, ['.ts', '.tsx']) * ``` */ export declare function filterByExtension(filePaths: string[], extensions: string[]): string[]; /** * Estimate memory usage for files * * Provides rough estimate based on file sizes. * * @param filePaths - Array of file paths * @returns Estimated memory usage in bytes * * @example * ```typescript * const estimate = await estimateMemoryUsage(paths) * console.log(`Estimated: ${MemoryMonitor.formatBytes(estimate)}`) * ``` */ export declare function estimateMemoryUsage(filePaths: string[]): Promise; //# sourceMappingURL=file-streamer.d.ts.map