nexus-agents - v2.80.0
    Preparing search index...

    Function collectStream

    Adapters exports - Model adapters (Claude, OpenAI, Gemini, Ollama) Split from index.ts for file size compliance (Issue #285)

    • Collects all chunks from a stream into an array.

      Type Parameters

      • T

      Parameters

      • stream: AsyncIterable<T>

        The stream to collect

      • options: { signal?: AbortSignal; maxChunks?: number } = {}

        Options including optional AbortSignal. maxChunks defaults to DEFAULT_COLLECT_STREAM_MAX_CHUNKS to prevent unbounded memory growth on forgotten limits. Pass Infinity explicitly for truly unbounded collection.

      Returns Promise<Result<T[], StreamError>>

      Result containing collected chunks or error