web-stream-kit
    Preparing search index...

    Class ThrottleStream<T>

    A TransformStream that limits chunk throughput over a specified time interval using a token bucket rate-limiting algorithm.

    // Allow at most 5 items per second
    const throttled = stream.pipeThrough(
    new ThrottleStream({ limit: 5, intervalMS: 1000 })
    );

    Type Parameters

    • T

      The type of items flowing through the stream.

    Hierarchy

    • TransformStream<T, T>
      • ThrottleStream
    Index
    • Constructs a new ThrottleStream.

      Type Parameters

      • T

        The type of items flowing through the stream.

      Parameters

      Returns ThrottleStream<T>

      If limit or intervalMS is less than or equal to 0.

    readable: ReadableStream<T>

    The readable read-only property of the TransformStream interface returns the ReadableStream instance controlled by this TransformStream.

    MDN Reference

    writable: WritableStream<T>

    The writable read-only property of the TransformStream interface returns the WritableStream instance controlled by this TransformStream.

    MDN Reference