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

Function pipeOnDrain

lib/internal/streams/readable.js:1088–1108  ·  view source on GitHub ↗
(src, dest)

Source from the content-addressed store, hash-verified

1086};
1087
1088function pipeOnDrain(src, dest) {
1089 return function pipeOnDrainFunctionResult() {
1090 const state = src._readableState;
1091
1092 // `ondrain` will call directly,
1093 // `this` maybe not a reference to dest,
1094 // so we use the real dest here.
1095 if (state.awaitDrainWriters === dest) {
1096 debug('pipeOnDrain', 1);
1097 state.awaitDrainWriters = null;
1098 } else if ((state[kState] & kMultiAwaitDrain) !== 0) {
1099 debug('pipeOnDrain', state.awaitDrainWriters.size);
1100 state.awaitDrainWriters.delete(dest);
1101 }
1102
1103 if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) &&
1104 (state[kState] & kDataListening) !== 0) {
1105 src.resume();
1106 }
1107 };
1108}
1109
1110
1111Readable.prototype.unpipe = function(dest) {

Callers 1

pauseFunction · 0.85

Calls 3

deleteMethod · 0.65
resumeMethod · 0.65
debugFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…