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

Function slowSource

test/parallel/test-stream-iter-broadcast-from.js:100–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98 // Create a slow async source that blocks between yields
99 let sourceFinished = false;
100 async function* slowSource() {
101 const enc = new TextEncoder();
102 yield [enc.encode('chunk1')];
103 // Simulate a long delay - the cancel should unblock this
104 await new Promise((resolve) => setTimeout(resolve, 10000));
105 yield [enc.encode('chunk2')];
106 sourceFinished = true;
107 }
108
109 const { broadcast: bc } = Broadcast.from(slowSource());
110 const consumer = bc.push();

Callers 1

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…