(file: Path)
| 13 | export type Path = AbsPath | RelPath; |
| 14 | |
| 15 | export async function readFileIfExists(file: Path): Promise<Buffer | null> { |
| 16 | try { |
| 17 | return await readFile(file); |
| 18 | } catch (error: unknown) { |
| 19 | if (!isErrnoException(error, 'ENOENT')) { |
| 20 | throw error; |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | return null; |
| 25 | } |
| 26 | |
| 27 | export async function readFileTextIfExists( |
| 28 | file: Path, |
no test coverage detected