( readFile: ReadFileFn, dir: string, filepath: string, )
| 304 | } |
| 305 | |
| 306 | async function readWorkdirAsText( |
| 307 | readFile: ReadFileFn, |
| 308 | dir: string, |
| 309 | filepath: string, |
| 310 | ): Promise<string> { |
| 311 | try { |
| 312 | const data = await readFile(`${dir}/${filepath}`); |
| 313 | if (typeof data === "string") return data; |
| 314 | return new TextDecoder("utf-8", { fatal: false, ignoreBOM: false }).decode(data); |
| 315 | } catch { |
| 316 | return ""; |
| 317 | } |
| 318 | } |
no test coverage detected