Web streams utils - v0.3.0
    Preparing search index...

    Function take

    • Limit the number of chunks from a stream

      Type Parameters

      • T

      Parameters

      • limit: number

        The maximum number of chunks to pass through

      Returns TransformStream<T, T>

      A TransformStream that limits the number of chunks

      const stream = readable.pipeThrough(take(3));
      // Only the first 3 chunks will pass through