diff options
Diffstat (limited to 'packages/core/src/utils/fileUtils.ts')
| -rw-r--r-- | packages/core/src/utils/fileUtils.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/core/src/utils/fileUtils.ts b/packages/core/src/utils/fileUtils.ts index 92186e4f..8dfdbc22 100644 --- a/packages/core/src/utils/fileUtils.ts +++ b/packages/core/src/utils/fileUtils.ts @@ -8,6 +8,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { PartUnion } from '@google/genai'; import mime from 'mime-types'; +import { FileSystemService } from '../services/fileSystemService.js'; // Constants for text file processing const DEFAULT_MAX_LINES_TEXT_FILE = 2000; @@ -223,6 +224,7 @@ export interface ProcessedFileReadResult { export async function processSingleFileContent( filePath: string, rootDirectory: string, + fileSystemService: FileSystemService, offset?: number, limit?: number, ): Promise<ProcessedFileReadResult> { @@ -279,14 +281,14 @@ export async function processSingleFileContent( returnDisplay: `Skipped large SVG file (>1MB): ${relativePathForDisplay}`, }; } - const content = await fs.promises.readFile(filePath, 'utf8'); + const content = await fileSystemService.readTextFile(filePath); return { llmContent: content, returnDisplay: `Read SVG as text: ${relativePathForDisplay}`, }; } case 'text': { - const content = await fs.promises.readFile(filePath, 'utf8'); + const content = await fileSystemService.readTextFile(filePath); const lines = content.split('\n'); const originalLineCount = lines.length; |
