MCPcopy
hub / github.com/react/react / readContent

Function readContent

packages/react-dom/src/__tests__/ReactDOMFizzStaticNode-test.js:34–45  ·  view source on GitHub ↗
(readable)

Source from the content-addressed store, hash-verified

32 }
33
34 function readContent(readable) {
35 return new Promise((resolve, reject) => {
36 let content = '';
37 readable.on('data', chunk => {
38 content += Buffer.from(chunk).toString('utf8');
39 });
40 readable.on('error', error => {
41 reject(error);
42 });
43 readable.on('end', () => resolve(content));
44 });
45 }
46
47 async function readContentWeb(stream) {
48 const reader = stream.getReader();

Callers 1

Calls 4

onMethod · 0.80
rejectFunction · 0.70
resolveFunction · 0.70
toStringMethod · 0.65

Tested by

no test coverage detected