(filename: string)
| 635 | * Try and read a file as a utf-8 text file, returning its contents if present, or undefined if not. |
| 636 | */ |
| 637 | export async function tryReadTextFile(filename: string): Promise<string | undefined> { |
| 638 | try { |
| 639 | return await fs.readFile(filename, 'utf8'); |
| 640 | } catch { |
| 641 | return undefined; |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | /** |
| 646 | * Try and read a file as a utf-8 json file, returning its contents if present, or undefined if not. |
no test coverage detected