( carry: Buffer | null, chunkBuf: Buffer, )
| 3310 | // null = carry spans whole chunk. Skips concat when carry provably isn't |
| 3311 | // a metadata line (markers sit at byte 1 after `{`). |
| 3312 | function resolveMetadataBuf( |
| 3313 | carry: Buffer | null, |
| 3314 | chunkBuf: Buffer, |
| 3315 | ): Buffer | null { |
| 3316 | if (carry === null || carry.length === 0) return chunkBuf |
| 3317 | if (carry.length < METADATA_PREFIX_BOUND) { |
| 3318 | return Buffer.concat([carry, chunkBuf]) |
| 3319 | } |
| 3320 | if (carry[0] === 0x7b /* { */) { |
| 3321 | for (const m of METADATA_MARKER_BUFS) { |
| 3322 | if (carry.compare(m, 0, m.length, 1, 1 + m.length) === 0) { |
| 3323 | return Buffer.concat([carry, chunkBuf]) |
| 3324 | } |
| 3325 | } |
| 3326 | } |
| 3327 | const firstNl = chunkBuf.indexOf(0x0a) |
| 3328 | return firstNl === -1 ? null : chunkBuf.subarray(firstNl + 1) |
| 3329 | } |
| 3330 | |
| 3331 | /** |
| 3332 | * Lightweight forward scan of [0, endOffset) collecting only metadata-entry lines. |
no outgoing calls
no test coverage detected