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

Method consumerReturn

lib/internal/streams/iter/push.js:415–430  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

413 }
414
415 consumerReturn() {
416 if (this.#consumerState !== 'active') return;
417 this.#consumerState = 'returned';
418 this.#cleanup();
419 this.#resolvePendingReads();
420 this.#rejectPendingWrites(
421 new ERR_INVALID_STATE.TypeError('Stream closed by consumer'));
422 // If closing, reject the pending end promise
423 if (this.#writerState === 'closing' && this.#pendingEnd) {
424 this.#pendingEnd.reject(
425 new ERR_INVALID_STATE.TypeError('Stream closed by consumer'));
426 this.#pendingEnd = null;
427 }
428 // Resolve pending drains with false - no more data will be consumed
429 this.#resolvePendingDrains(false);
430 }
431
432 consumerThrow(error) {
433 if (this.#consumerState !== 'active') return;

Callers 1

returnFunction · 0.80

Calls 5

#cleanupMethod · 0.95
#resolvePendingReadsMethod · 0.95
#rejectPendingWritesMethod · 0.95
#resolvePendingDrainsMethod · 0.95
rejectMethod · 0.80

Tested by

no test coverage detected