Class LimitedTransformStream<T>
Type Parameters
Index
Constructors
Properties
Constructors
constructor
- new
Limited <T>(size, options?): LimitedTransformStream<T>Transform Stream Constructs a new instance.
Type Parameters
Parameters
- size: number
The maximum number of chunks to read.
- options: LimitedTransformStreamOptions = ...
Options for the stream.
Returns LimitedTransformStream<T>
- size: number
A TransformStream that will only read & enqueue
sizeamount of chunks.If
options.erroris set, then instead of terminating the stream, a RangeError will be thrown when the total number of enqueued chunks is about to exceed the specified size.Typeparam
T The type the chunks in the stream.
Example: `size` is equal to the total number of chunks
Example: `size` is less than the total number of chunks
Example: Throw a {@linkcode RangeError} when the total number of chunks is
about to exceed the specified limit
Do this by setting
options.errortotrue.