MCPcopy Create free account
hub / github.com/WinterTC55/iter-streams / constructor

Method constructor

src/push.ts:106–125  ·  view source on GitHub ↗
(options: PushStreamOptions = {})

Source from the content-addressed store, hash-verified

104 private abortHandler?: () => void;
105
106 constructor(options: PushStreamOptions = {}) {
107 this.highWaterMark = Math.max(1, options.highWaterMark ?? 4);
108 this.backpressure = options.backpressure ?? 'strict';
109 this.signal = options.signal;
110
111 if (this.signal) {
112 if (this.signal.aborted) {
113 this.fail(this.signal.reason instanceof Error
114 ? this.signal.reason
115 : new DOMException('Aborted', 'AbortError'));
116 } else {
117 this.abortHandler = () => {
118 this.fail(this.signal!.reason instanceof Error
119 ? this.signal!.reason
120 : new DOMException('Aborted', 'AbortError'));
121 };
122 this.signal.addEventListener('abort', this.abortHandler, { once: true });
123 }
124 }
125 }
126
127 // ===========================================================================
128 // Writer Methods

Callers

nothing calls this directly

Calls 1

failMethod · 0.95

Tested by

no test coverage detected