( file: Path, encoding: BufferEncoding = 'utf8' )
| 25 | } |
| 26 | |
| 27 | export async function readFileTextIfExists( |
| 28 | file: Path, |
| 29 | encoding: BufferEncoding = 'utf8' |
| 30 | ): Promise<string | null> { |
| 31 | const data = await readFileIfExists(file); |
| 32 | if (data == null) { |
| 33 | return null; |
| 34 | } else { |
| 35 | return data.toString(encoding); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | export function normalizePath(p: Path): AbsPath { |
| 40 | let np = path.normalize(p); |
no test coverage detected