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

Function errorBuffer

lib/internal/streams/writable.js:723–741  ·  view source on GitHub ↗
(state)

Source from the content-addressed store, hash-verified

721
722// If there's something in the buffer waiting, then invoke callbacks.
723function errorBuffer(state) {
724 if ((state[kState] & kWriting) !== 0) {
725 return;
726 }
727
728 if ((state[kState] & kBuffered) !== 0) {
729 for (let n = state.bufferedIndex; n < state.buffered.length; ++n) {
730 const { chunk, callback } = state[kBufferedValue][n];
731 const len = (state[kState] & kObjectMode) !== 0 ? 1 : chunk.length;
732 state.length -= len;
733 callback(state.errored ?? new ERR_STREAM_DESTROYED('write'));
734 }
735 }
736
737
738 callFinishedCallbacks(state, state.errored ?? new ERR_STREAM_DESTROYED('end'));
739
740 resetBuffer(state);
741}
742
743// If there's something in the buffer waiting, then process it.
744function clearBuffer(stream, state) {

Callers 2

onwriteErrorFunction · 0.85
afterWriteFunction · 0.85

Calls 3

callFinishedCallbacksFunction · 0.85
resetBufferFunction · 0.70
callbackFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…