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

Function writableStreamAbort

lib/internal/webstreams/writablestream.js:696–729  ·  view source on GitHub ↗
(stream, reason)

Source from the content-addressed store, hash-verified

694}
695
696function writableStreamAbort(stream, reason) {
697 const {
698 state,
699 controller,
700 } = stream[kState];
701 if (state === 'closed' || state === 'errored')
702 return PromiseResolve();
703
704 controller[kState].abortController.abort(reason);
705
706 if (stream[kState].pendingAbortRequest.abort.promise !== undefined)
707 return stream[kState].pendingAbortRequest.abort.promise;
708
709 assert(state === 'writable' || state === 'erroring');
710
711 let wasAlreadyErroring = false;
712 if (state === 'erroring') {
713 wasAlreadyErroring = true;
714 reason = undefined;
715 }
716
717 const abort = PromiseWithResolvers();
718
719 stream[kState].pendingAbortRequest = {
720 abort,
721 reason,
722 wasAlreadyErroring,
723 };
724
725 if (!wasAlreadyErroring)
726 writableStreamStartErroring(stream, reason);
727
728 return abort.promise;
729}
730
731function writableStreamClose(stream) {
732 const {

Callers 4

abortMethod · 0.85
abortAlgorithmFunction · 0.85
readableStreamPipeToFunction · 0.85

Calls 3

abortMethod · 0.65
assertFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…