( filePath: string, maxSizeBytes: number = MAX_OUTPUT_SIZE, )
| 545 | * @returns true if file size is within limit, false otherwise |
| 546 | */ |
| 547 | export function isFileWithinReadSizeLimit( |
| 548 | filePath: string, |
| 549 | maxSizeBytes: number = MAX_OUTPUT_SIZE, |
| 550 | ): boolean { |
| 551 | try { |
| 552 | const stats = getFsImplementation().statSync(filePath) |
| 553 | return stats.size <= maxSizeBytes |
| 554 | } catch { |
| 555 | // If we can't stat the file, return false to indicate validation failure |
| 556 | return false |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | /** |
| 561 | * Normalize a file path for comparison, handling platform differences. |
no test coverage detected