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

Function readStream

test/parallel/test-vfs-stream-explicit-fd.js:13–20  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

11myVfs.writeFileSync('/file.txt', 'hello world');
12
13function readStream(stream) {
14 return new Promise((resolve, reject) => {
15 const chunks = [];
16 stream.on('data', (c) => chunks.push(c));
17 stream.on('end', () => resolve(Buffer.concat(chunks).toString()));
18 stream.on('error', reject);
19 });
20}
21
22// Read using an existing fd; autoClose:false leaves fd open
23{

Callers 1

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…