( filePath: string, )
| 81 | * Returns null if file doesn't exist or can't be read |
| 82 | */ |
| 83 | export async function readFileLines( |
| 84 | filePath: string, |
| 85 | ): Promise<string[] | null> { |
| 86 | try { |
| 87 | const content = await readFile(filePath, { encoding: 'utf8' }) |
| 88 | return content.split('\n') |
| 89 | } catch (e: unknown) { |
| 90 | if (isFsInaccessible(e)) return null |
| 91 | throw e |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Write lines back to a file |
no test coverage detected