()
| 3463 | let currentBatchSize = 0; |
| 3464 | let batchBuffers: { buffer: Buffer; actualSize: number; poolBuffer: Buffer }[] = []; |
| 3465 | const flushBatch = async () => { |
| 3466 | if (batchBuffers.length > 0) { |
| 3467 | // Create array of buffer slices for concatenation |
| 3468 | const bufferSlices = batchBuffers.map((item) => item.buffer.subarray(0, item.actualSize)); |
| 3469 | const combinedBuffer = Buffer.concat(bufferSlices); |
| 3470 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
| 3471 | await outFile!.write(combinedBuffer); |
| 3472 | // Return all buffers to pool |
| 3473 | for (const item of batchBuffers) { |
| 3474 | bufferPool.returnBuffer(item.poolBuffer, item.actualSize); |
| 3475 | } |
| 3476 | batchBuffers = []; |
| 3477 | currentBatchSize = 0; |
| 3478 | } |
| 3479 | }; |
| 3480 | try { |
| 3481 | for (const file of finalPackedFiles) { |
| 3482 | // Fast O(1) lookup instead of O(N) find operations |
no test coverage detected