(state)
| 721 | |
| 722 | // If there's something in the buffer waiting, then invoke callbacks. |
| 723 | function 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. |
| 744 | function clearBuffer(stream, state) { |
no test coverage detected
searching dependent graphs…