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

Function drainBatch

lib/internal/streams/iter/transform.js:439–457  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

437 }
438
439 function drainBatch() {
440 if (pendingBytes <= BATCH_HWM) {
441 // Swap instead of splice - avoids copying the array.
442 const batch = pending;
443 pending = [];
444 pendingBytes = 0;
445 return batch;
446 }
447 const batch = [];
448 let batchBytes = 0;
449 while (pending.length > 0 && batchBytes < BATCH_HWM) {
450 const buf = ArrayPrototypeShift(pending);
451 ArrayPrototypePush(batch, buf);
452 const len = TypedArrayPrototypeGetByteLength(buf);
453 batchBytes += len;
454 pendingBytes -= len;
455 }
456 return batch;
457 }
458
459 let finalized = false;
460

Callers 2

makeZlibTransformFunction · 0.85
makeZlibTransformSyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…