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

Function readableByteStreamControllerClose

lib/internal/webstreams/readablestream.js:2710–2737  ·  view source on GitHub ↗
(controller)

Source from the content-addressed store, hash-verified

2708}
2709
2710function readableByteStreamControllerClose(controller) {
2711 const {
2712 closeRequested,
2713 pendingPullIntos,
2714 queueTotalSize,
2715 stream,
2716 } = controller[kState];
2717
2718 if (closeRequested || stream[kState].state !== 'readable')
2719 return;
2720
2721 if (queueTotalSize) {
2722 controller[kState].closeRequested = true;
2723 return;
2724 }
2725
2726 if (pendingPullIntos.length) {
2727 const firstPendingPullInto = pendingPullIntos[0];
2728 if (firstPendingPullInto.bytesFilled % firstPendingPullInto.elementSize !== 0) {
2729 const error = new ERR_INVALID_STATE.TypeError('Partial read');
2730 readableByteStreamControllerError(controller, error);
2731 throw error;
2732 }
2733 }
2734
2735 readableByteStreamControllerClearAlgorithms(controller);
2736 readableStreamClose(stream);
2737}
2738
2739function readableByteStreamControllerCommitPullIntoDescriptor(stream, desc) {
2740 assert(stream[kState].state !== 'errored');

Callers 3

closeMethod · 0.85
[kClose]Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…