MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / CreateReadableStream

Function CreateReadableStream

examples/io/streams/modules/streams.js:737–746  ·  view source on GitHub ↗
(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark = 1, sizeAlgorithm = () => 1)

Source from the content-addressed store, hash-verified

735const defaultSizeAlgorithm = function() { return 1 }
736
737function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark = 1, sizeAlgorithm = () => 1) {
738 assert(IsNonNegativeNumber(highWaterMark) === true);
739 const stream = new ReadableStream(ReadableStreamBrand.token);
740 InitializeReadableStream(stream);
741 const controller = new ReadableStreamDefaultController(ReadableStreamDefaultControllerBrand.token);
742 SetUpReadableStreamDefaultController(
743 stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm
744 );
745 return stream;
746}
747function CreateReadableByteStream(startAlgorithm, pullAlgorithm, cancelAlgorithm) {
748 const stream = new ReadableStream(ReadableStreamBrand.token);
749 InitializeReadableStream(stream);

Callers 3

ReadableStreamDefaultTeeFunction · 0.85

Calls 4

IsNonNegativeNumberFunction · 0.85
InitializeReadableStreamFunction · 0.85
assertFunction · 0.70

Tested by

no test coverage detected