(absolute: string, displayPath: string)
| 367 | } |
| 368 | |
| 369 | async 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 | |
| 376 | async function readUtf8Text(absolute: string, displayPath: string): Promise<string> { |
| 377 | const bytes = await readFile(absolute); |
no test coverage detected