( workspaceDir: string, relPath: string, )
| 102 | * within the same traversal guard). |
| 103 | */ |
| 104 | export async function readWorkspaceFile( |
| 105 | workspaceDir: string, |
| 106 | relPath: string, |
| 107 | ): Promise<string | null> { |
| 108 | const abs = resolveInside(workspaceDir, relPath); |
| 109 | try { |
| 110 | return await nodeReadFile(abs, 'utf8'); |
| 111 | } catch (err) { |
| 112 | if (isENOENT(err)) return null; |
| 113 | throw err; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Atomically write a UTF-8 text file at `<workspaceDir>/<relPath>`. |
no test coverage detected