MCPcopy Create free account
hub / github.com/nodejs/node / yieldBoundedBatch

Function yieldBoundedBatch

lib/internal/streams/iter/from.js:193–204  ·  view source on GitHub ↗
(batch)

Source from the content-addressed store, hash-verified

191}
192
193function* yieldBoundedBatch(batch) {
194 if (batch.length === 0) {
195 return;
196 }
197 if (batch.length <= FROM_BATCH_SIZE) {
198 yield batch;
199 return;
200 }
201 for (let i = 0; i < batch.length; i += FROM_BATCH_SIZE) {
202 yield ArrayPrototypeSlice(batch, i, i + FROM_BATCH_SIZE);
203 }
204}
205
206/**
207 * Normalize a sync streamable source, yielding batches of Uint8Array.

Callers 2

normalizeSyncSourceFunction · 0.85
normalizeAsyncSourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected