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

Function emitReadable_

lib/internal/streams/readable.js:844–862  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

842}
843
844function emitReadable_(stream) {
845 const state = stream._readableState;
846 debug('emitReadable_');
847 if ((state[kState] & (kDestroyed | kErrored)) === 0 && (state.length || (state[kState] & kEnded) !== 0)) {
848 stream.emit('readable');
849 state[kState] &= ~kEmittedReadable;
850 }
851
852 // The stream needs another readable event if:
853 // 1. It is not flowing, as the flow mechanism will take
854 // care of it.
855 // 2. It is not ended.
856 // 3. It is below the highWaterMark, so we can schedule
857 // another readable later.
858 state[kState] |=
859 (state[kState] & (kFlowing | kEnded)) === 0 &&
860 state.length <= state.highWaterMark ? kNeedReadable : 0;
861 flow(stream);
862}
863
864
865// At this point, the user has presumably seen the 'readable' event,

Callers 1

onEofChunkFunction · 0.85

Calls 3

flowFunction · 0.70
debugFunction · 0.50
emitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…