(batch, startIndex)
| 1012 | // Async fallback for writeBatch when sync write fails partway through. |
| 1013 | // Continues writing from batch[startIndex] using async write(). |
| 1014 | async function writeBatchAsyncFallback(batch, startIndex) { |
| 1015 | for (let i = startIndex; i < batch.length; i++) { |
| 1016 | const chunk = batch[i]; |
| 1017 | if (hasWriteSync && writer.writeSync(chunk)) { |
| 1018 | // Sync retry succeeded |
| 1019 | } else { |
| 1020 | const result = writer.write( |
| 1021 | chunk, signal ? { __proto__: null, signal } : undefined); |
| 1022 | if (result !== undefined) { |
| 1023 | await result; |
| 1024 | } |
| 1025 | } |
| 1026 | totalBytes += TypedArrayPrototypeGetByteLength(chunk); |
| 1027 | } |
| 1028 | } |
| 1029 | |
| 1030 | // Write a batch using try-fallback: sync first, async if needed. |
| 1031 | // Returns undefined on sync success, or a Promise when async fallback |
no test coverage detected
searching dependent graphs…