(content: FileContent)
| 7 | let total = 0 |
| 8 | |
| 9 | export function approxBytes(content: FileContent) { |
| 10 | const patchBytes = |
| 11 | content.patch?.hunks.reduce((sum, hunk) => { |
| 12 | return sum + hunk.lines.reduce((lineSum, line) => lineSum + line.length, 0) |
| 13 | }, 0) ?? 0 |
| 14 | |
| 15 | return (content.content.length + (content.diff?.length ?? 0) + patchBytes) * 2 |
| 16 | } |
| 17 | |
| 18 | function setBytes(path: string, nextBytes: number) { |
| 19 | const prev = lru.get(path) |