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

Function afterWrite

lib/internal/streams/writable.js:699–720  ·  view source on GitHub ↗
(stream, state, count, cb)

Source from the content-addressed store, hash-verified

697}
698
699function afterWrite(stream, state, count, cb) {
700 state[kState] &= ~kAfterWritePending;
701
702 const needDrain = (state[kState] & (kEnding | kNeedDrain | kDestroyed)) === kNeedDrain && state.length === 0;
703 if (needDrain) {
704 state[kState] &= ~kNeedDrain;
705 stream.emit('drain');
706 }
707
708 while (count-- > 0) {
709 state.pendingcb--;
710 cb(null);
711 }
712
713 if ((state[kState] & kDestroyed) !== 0) {
714 errorBuffer(state);
715 }
716
717 if ((state[kState] & kEnding) !== 0) {
718 finishMaybe(stream, state, true);
719 }
720}
721
722// If there's something in the buffer waiting, then invoke callbacks.
723function errorBuffer(state) {

Callers 2

onwriteFunction · 0.70
afterWriteTickFunction · 0.70

Calls 4

errorBufferFunction · 0.85
finishMaybeFunction · 0.85
cbFunction · 0.70
emitMethod · 0.45

Tested by

no test coverage detected