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

Function finishMaybe

lib/internal/streams/writable.js:928–947  ·  view source on GitHub ↗
(stream, state, sync)

Source from the content-addressed store, hash-verified

926}
927
928function finishMaybe(stream, state, sync) {
929 if (needFinish(state)) {
930 prefinish(stream, state);
931 if (state.pendingcb === 0) {
932 if (sync) {
933 state.pendingcb++;
934 process.nextTick((stream, state) => {
935 if (needFinish(state)) {
936 finish(stream, state);
937 } else {
938 state.pendingcb--;
939 }
940 }, stream, state);
941 } else if (needFinish(state)) {
942 state.pendingcb++;
943 finish(stream, state);
944 }
945 }
946 }
947}
948
949function finish(stream, state) {
950 state.pendingcb--;

Callers 3

writable.jsFile · 0.85
onwriteFunction · 0.85
afterWriteFunction · 0.85

Calls 3

needFinishFunction · 0.85
prefinishFunction · 0.70
finishFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…