( cg: CodeGraph, projectRoot: string, requested: string, maxBytes: number )
| 168 | * answer to it than the bytes we indexed. |
| 169 | */ |
| 170 | export function readIndexedFileText( |
| 171 | cg: CodeGraph, |
| 172 | projectRoot: string, |
| 173 | requested: string, |
| 174 | maxBytes: number |
| 175 | ): string | null { |
| 176 | try { |
| 177 | const found = findIndexedFile(cg, requested); |
| 178 | if (!found) return null; |
| 179 | const absolute = resolveProjectFile(projectRoot, found.storedPath); |
| 180 | const stats = fs.statSync(absolute); |
| 181 | if (!stats.isFile() || stats.size > maxBytes) return null; |
| 182 | return fs.readFileSync(absolute, 'utf8'); |
| 183 | } catch { |
| 184 | return null; |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Whether an indexed file has changed on disk since it was indexed — the same |
no test coverage detected