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

Function slowSource

test/parallel/test-stream-iter-share-async.js:287–293  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

285 // Multiple consumers pulling concurrently should each receive all items
286 // even when only one item is pulled from source at a time.
287 async function* slowSource() {
288 const enc = new TextEncoder();
289 for (let i = 0; i < 5; i++) {
290 await setTimeout(1);
291 yield [enc.encode(`item-${i}`)];
292 }
293 }
294 const shared = share(slowSource());
295 const c1 = shared.pull();
296 const c2 = shared.pull();

Calls 2

encodeMethod · 0.95
setTimeoutFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…