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

Method write

test/parallel/test-repl-top-level-await.js:22–34  ·  view source on GitHub ↗
(chunk, encoding, callback)

Source from the content-addressed store, hash-verified

20 this.lines = [''];
21 }
22 write(chunk, encoding, callback) {
23 if (Buffer.isBuffer(chunk)) {
24 chunk = chunk.toString(encoding);
25 }
26 const chunkLines = stripVTControlCharacters(chunk).split('\n');
27 this.lines[this.lines.length - 1] += chunkLines[0];
28 if (chunkLines.length > 1) {
29 this.lines.push(...chunkLines.slice(1));
30 }
31 this.emit('line', this.lines[this.lines.length - 1]);
32 if (callback) callback();
33 return true;
34 }
35
36 async wait() {
37 if (this.waitingForResponse) {

Callers 1

runAndWaitFunction · 0.45

Calls 7

stripVTControlCharactersFunction · 0.85
callbackFunction · 0.70
sliceMethod · 0.65
toStringMethod · 0.45
splitMethod · 0.45
pushMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected