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

Function makeBufferingDataCallback

test/common/inspector-helper.js:33–46  ·  view source on GitHub ↗
(dataCallback)

Source from the content-addressed store, hash-verified

31}
32
33function makeBufferingDataCallback(dataCallback) {
34 let buffer = Buffer.alloc(0);
35 return (data) => {
36 const newData = Buffer.concat([buffer, data]);
37 const str = newData.toString('utf8');
38 const lines = str.replace(/\r/g, '').split('\n');
39 if (str.endsWith('\n'))
40 buffer = Buffer.alloc(0);
41 else
42 buffer = Buffer.from(lines.pop(), 'utf8');
43 for (const line of lines)
44 dataCallback(line);
45 };
46}
47
48function tearDown(child, err) {
49 child.kill();

Callers 1

constructorMethod · 0.85

Calls 6

allocMethod · 0.80
concatMethod · 0.80
popMethod · 0.80
toStringMethod · 0.45
splitMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…