MCPcopy Index your code
hub / github.com/codeaashu/claude-code / readFileForEdit

Function readFileForEdit

src/tools/FileEditTool/FileEditTool.ts:599–625  ·  view source on GitHub ↗
(absoluteFilePath: string)

Source from the content-addressed store, hash-verified

597// --
598
599function readFileForEdit(absoluteFilePath: string): {
600 content: string
601 fileExists: boolean
602 encoding: BufferEncoding
603 lineEndings: LineEndingType
604} {
605 try {
606 // eslint-disable-next-line custom-rules/no-sync-fs
607 const meta = readFileSyncWithMetadata(absoluteFilePath)
608 return {
609 content: meta.content,
610 fileExists: true,
611 encoding: meta.encoding,
612 lineEndings: meta.lineEndings,
613 }
614 } catch (e) {
615 if (isENOENT(e)) {
616 return {
617 content: '',
618 fileExists: false,
619 encoding: 'utf8',
620 lineEndings: 'LF',
621 }
622 }
623 throw e
624 }
625}
626

Callers 1

callFunction · 0.85

Calls 2

readFileSyncWithMetadataFunction · 0.85
isENOENTFunction · 0.85

Tested by

no test coverage detected