(abs: string)
| 338 | } |
| 339 | |
| 340 | async function readUtf8TextFile(abs: string): Promise<string> { |
| 341 | const bytes = await readFile(abs); |
| 342 | const content = UTF8_DECODER.decode(bytes); |
| 343 | if (content.indexOf('\u0000') !== -1) { |
| 344 | throw new Error('binary file contains NUL byte'); |
| 345 | } |
| 346 | return content; |
| 347 | } |
| 348 | |
| 349 | /** |
| 350 | * Recursively list all files under `root`, returning metadata only (path, |
no outgoing calls
no test coverage detected