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

Function initializeTransformStream

lib/internal/webstreams/transformstream.js:360–402  ·  view source on GitHub ↗
(
  stream,
  startPromise,
  writableHighWaterMark,
  writableSizeAlgorithm,
  readableHighWaterMark,
  readableSizeAlgorithm)

Source from the content-addressed store, hash-verified

358}
359
360function initializeTransformStream(
361 stream,
362 startPromise,
363 writableHighWaterMark,
364 writableSizeAlgorithm,
365 readableHighWaterMark,
366 readableSizeAlgorithm) {
367
368 const startAlgorithm = () => startPromise.promise;
369
370 const writable = createWritableStream(
371 startAlgorithm,
372 (chunk) => transformStreamDefaultSinkWriteAlgorithm(stream, chunk),
373 () => transformStreamDefaultSinkCloseAlgorithm(stream),
374 (reason) => transformStreamDefaultSinkAbortAlgorithm(stream, reason),
375 writableHighWaterMark,
376 writableSizeAlgorithm,
377 );
378
379 const readable = createReadableStream(
380 startAlgorithm,
381 () => transformStreamDefaultSourcePullAlgorithm(stream),
382 (reason) => transformStreamDefaultSourceCancelAlgorithm(stream, reason),
383 readableHighWaterMark,
384 readableSizeAlgorithm,
385 );
386
387 stream[kState] = {
388 __proto__: null,
389 readable,
390 writable,
391 controller: undefined,
392 backpressure: undefined,
393 backpressureChange: {
394 __proto__: null,
395 promise: undefined,
396 resolve: undefined,
397 reject: undefined,
398 },
399 };
400
401 transformStreamSetBackpressure(stream, true);
402}
403
404function transformStreamError(stream, error) {
405 const {

Callers 1

constructorMethod · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…