MCPcopy Index your code
hub / github.com/nodejs/node / writeBatchAsyncFallback

Function writeBatchAsyncFallback

lib/internal/streams/iter/pull.js:1014–1028  ·  view source on GitHub ↗
(batch, startIndex)

Source from the content-addressed store, hash-verified

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

Callers 1

writeBatchFunction · 0.85

Calls 2

writeSyncMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…