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

Function readRequiredTextFile

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

Source from the content-addressed store, hash-verified

360}
361
362async function readRequiredTextFile(absolute: string, displayPath: string): Promise<TextFile> {
363 if (!(await fileExists(absolute))) throw patchError(`file does not exist: ${displayPath}`);
364 const metadata = await stat(absolute);
365 if (!metadata.isFile()) throw patchError(`path is not a regular file: ${displayPath}`);
366 return { content: await readUtf8Text(absolute, displayPath), mode: metadata.mode };
367}
368
369async function readOptionalTextFile(absolute: string, displayPath: string): Promise<TextFile | null> {
370 if (!(await fileExists(absolute))) return null;

Callers 1

applyPatchFunction · 0.85

Calls 3

fileExistsFunction · 0.85
patchErrorFunction · 0.85
readUtf8TextFunction · 0.85

Tested by

no test coverage detected