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

Function collect

test/parallel/test-stream-iter-to-readable.js:19–26  ·  view source on GitHub ↗
(readable)

Source from the content-addressed store, hash-verified

17} = require('stream/iter');
18
19function collect(readable) {
20 return new Promise((resolve, reject) => {
21 const chunks = [];
22 readable.on('data', (chunk) => chunks.push(chunk));
23 readable.on('end', () => resolve(Buffer.concat(chunks)));
24 readable.on('error', reject);
25 });
26}
27
28// =============================================================================
29// fromStreamIter: basic async round-trip

Callers 8

testBasicAsyncFunction · 0.70
testMultiBatchAsyncFunction · 0.70
testEmptyAsyncFunction · 0.70
testEmptyBatchAsyncFunction · 0.70
testLargeDataAsyncFunction · 0.70
testWithTransformAsyncFunction · 0.70
testBasicSyncFunction · 0.70

Calls 4

concatMethod · 0.80
resolveFunction · 0.50
onMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected