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

Method ondata

lib/internal/js_stream_socket.js:66–80  ·  view source on GitHub ↗
(chunk)

Source from the content-addressed store, hash-verified

64 stream.pause();
65 stream.on('error', (err) => this.emit('error', err));
66 const ondata = (chunk) => {
67 if (typeof chunk === 'string' ||
68 stream.readableObjectMode === true) {
69 // Make sure that no further `data` events will happen.
70 stream.pause();
71 stream.removeListener('data', ondata);
72
73 this.emit('error', new ERR_STREAM_WRAP());
74 return;
75 }
76
77 debug('data', chunk.length);
78 if (this._handle)
79 this._handle.readBuffer(chunk);
80 };
81 stream.on('data', ondata);
82 stream.once('end', () => {
83 debug('end');

Callers 1

writeChunkMethod · 0.80

Calls 4

pauseMethod · 0.65
debugFunction · 0.50
removeListenerMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected