(absolute: string, displayPath: string)
| 360 | } |
| 361 | |
| 362 | async 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 | |
| 369 | async function readOptionalTextFile(absolute: string, displayPath: string): Promise<TextFile | null> { |
| 370 | if (!(await fileExists(absolute))) return null; |
no test coverage detected