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

Method constructor

lib/internal/webstreams/writablestream.js:184–202  ·  view source on GitHub ↗

* @param {UnderlyingSink} [sink] * @param {QueuingStrategy} [strategy]

(sink = kEmptyObject, strategy = kEmptyObject)

Source from the content-addressed store, hash-verified

182 * @param {QueuingStrategy} [strategy]
183 */
184 constructor(sink = kEmptyObject, strategy = kEmptyObject) {
185 markTransferMode(this, false, true);
186 validateObject(sink, 'sink', kValidateObjectAllowObjects);
187 validateObject(strategy, 'strategy', kValidateObjectAllowObjectsAndNull);
188 const type = sink?.type;
189 if (type !== undefined)
190 throw new ERR_INVALID_ARG_VALUE.RangeError('type', type);
191
192 this[kState] = createWritableStreamState();
193
194 const size = extractSizeAlgorithm(strategy?.size);
195 const highWaterMark = extractHighWaterMark(strategy?.highWaterMark, 1);
196
197 setupWritableStreamDefaultControllerFromSink(
198 this,
199 sink,
200 highWaterMark,
201 size);
202 }
203
204 get [kIsErrored]() {
205 return this[kState].state === 'errored';

Callers

nothing calls this directly

Calls 5

markTransferModeFunction · 0.85
extractSizeAlgorithmFunction · 0.85
extractHighWaterMarkFunction · 0.85

Tested by

no test coverage detected