MCPcopy
hub / github.com/codeaashu/claude-code / isFileWithinReadSizeLimit

Function isFileWithinReadSizeLimit

src/utils/file.ts:547–558  ·  view source on GitHub ↗
(
  filePath: string,
  maxSizeBytes: number = MAX_OUTPUT_SIZE,
)

Source from the content-addressed store, hash-verified

545 * @returns true if file size is within limit, false otherwise
546 */
547export 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.

Callers 2

generateSyntheticDiffFunction · 0.85
generateFileAttachmentFunction · 0.85

Calls 1

getFsImplementationFunction · 0.85

Tested by

no test coverage detected