(handle, stream, source)
| 1459 | } |
| 1460 | |
| 1461 | async function consumeAsyncSource(handle, stream, source) { |
| 1462 | handle.initStreamingSource(); |
| 1463 | initStreamingBackpressure(stream); |
| 1464 | try { |
| 1465 | // Normalize to AsyncIterable<Uint8Array[]> |
| 1466 | const normalized = streamFrom(source); |
| 1467 | for await (const batch of normalized) { |
| 1468 | if (stream.destroyed) return; |
| 1469 | if (await writeBatchWithDrain(handle, stream, batch)) return; |
| 1470 | } |
| 1471 | handle.endWrite(); |
| 1472 | } catch (err) { |
| 1473 | if (!stream.destroyed) { |
| 1474 | stream.destroy(err); |
| 1475 | } else { |
| 1476 | throw err; |
| 1477 | } |
| 1478 | } |
| 1479 | } |
| 1480 | |
| 1481 | async function consumeSyncSource(handle, stream, source) { |
| 1482 | handle.initStreamingSource(); |
no test coverage detected
searching dependent graphs…