MCPcopy Index your code
hub / github.com/Waishnav/devspace / readOptionalTextFile

Function readOptionalTextFile

src/apply-patch.ts:369–374  ·  view source on GitHub ↗
(absolute: string, displayPath: string)

Source from the content-addressed store, hash-verified

367}
368
369async function readOptionalTextFile(absolute: string, displayPath: string): Promise<TextFile | null> {
370 if (!(await fileExists(absolute))) return null;
371 const metadata = await stat(absolute);
372 if (!metadata.isFile()) throw patchError(`path is not a regular file: ${displayPath}`);
373 return { content: await readUtf8Text(absolute, displayPath), mode: metadata.mode };
374}
375
376async function readUtf8Text(absolute: string, displayPath: string): Promise<string> {
377 const bytes = await readFile(absolute);

Callers 1

applyPatchFunction · 0.85

Calls 3

fileExistsFunction · 0.85
patchErrorFunction · 0.85
readUtf8TextFunction · 0.85

Tested by

no test coverage detected