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

Function cleanup

lib/internal/streams/readable.js:968–992  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

966
967 let cleanedUp = false;
968 function cleanup() {
969 debug('cleanup');
970 // Cleanup event handlers once the pipe is broken.
971 dest.removeListener('close', onclose);
972 dest.removeListener('finish', onfinish);
973 if (ondrain) {
974 dest.removeListener('drain', ondrain);
975 }
976 dest.removeListener('error', onerror);
977 dest.removeListener('unpipe', onunpipe);
978 src.removeListener('end', onend);
979 src.removeListener('end', unpipe);
980 src.removeListener('data', ondata);
981
982 cleanedUp = true;
983
984 // If the reader is waiting for a drain event from this
985 // specific writer, then it would cause it to never start
986 // flowing again.
987 // So, if this is awaiting a drain, then we just call it now.
988 // If we don't know, then assume that we are waiting for one.
989 if (ondrain && state.awaitDrainWriters &&
990 (!dest._writableState || dest._writableState.needDrain))
991 ondrain();
992 }
993
994 function pause() {
995 // If the user unpiped during `dest.write()`, it is possible

Callers 2

onunpipeFunction · 0.70
createAsyncIteratorFunction · 0.70

Calls 3

ondrainFunction · 0.70
debugFunction · 0.50
removeListenerMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…