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

Function read

test/parallel/test-whatwg-readablebytestream.js:132–144  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

130 assert(stream[kState].controller instanceof ReadableByteStreamController);
131
132 async function read(stream) {
133 const reader = stream.getReader({ mode: 'byob' });
134
135 const chunks = [];
136 let result;
137 do {
138 result = await reader.read(Buffer.alloc(100));
139 if (result.value !== undefined)
140 chunks.push(Buffer.from(result.value));
141 } while (!result.done);
142
143 return Buffer.concat(chunks);
144 }
145
146 read(stream).then(common.mustCall((data) => {
147 const check = readFileSync(__filename);

Calls 6

getReaderMethod · 0.80
allocMethod · 0.80
concatMethod · 0.80
readMethod · 0.45
pushMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected