LiveKit JS Client SDK - v2.22.2
    Preparing search index...

    Class TextStreamReader

    A class to read chunks from a ReadableStream and decode them as UTF-8 text.

    NOTE: chunk-level version (resending a chunk at an already-received chunkIndex to supersede it) is not supported. The reader used to rebuild the whole string from a per-index chunk map and yield it as TextStreamChunk.collected, which made superseding work; 5d4a6346 (#1410, text auto chunking) changed the iterator to yield each chunk's text as it arrives, and a streaming reader cannot retract text it has already handed to the consumer. No sender emits a versioned chunk.

    Hierarchy

    Index
    onProgress?: (progress: number | undefined) => void

    Type Declaration

      • (progress: number | undefined): void
      • Parameters

        • progress: number | undefined

          progress of the stream between 0 and 1. Undefined for streams of unknown size

        Returns void

    signal?: AbortSignal
    • Async iterator implementation to allow usage of for await...of syntax. Yields each chunk's decoded text as it arrives - a delta, not the string accumulated so far.

      Returns {
          next: () => Promise<IteratorResult<string, any>>;
          return(): Promise<IteratorResult<string, any>>;
      }

    • Injects an AbortSignal, which if aborted, will terminate the currently active stream iteration operation.

      Note that when using AbortSignal.timeout(...), the timeout applies across the whole iteration operation, not just one individual chunk read.

      Parameters

      • signal: AbortSignal

      Returns TextStreamReader