mogami-stream - v0.2.0
    Preparing search index...

    Interface StreamIterator<T>

    An AsyncIterableIterator with explicit cancellation control and a closed lifecycle promise.

    interface StreamIterator<T> {
        closed: Promise<CloseReport>;
        "[asyncIterator]"(): AsyncIterableIterator<T, unknown, undefined>;
        cancel(reason?: unknown): void;
        next(
            ...__namedParameters: [] | [undefined],
        ): Promise<IteratorResult<T, unknown>>;
        return(value?: unknown): Promise<IteratorResult<T, unknown>>;
        throw(error?: unknown): Promise<IteratorResult<T, unknown>>;
    }

    Type Parameters

    • T

    Hierarchy

    • AsyncIterableIterator<T, unknown, undefined>
      • StreamIterator
    Index
    closed: Promise<CloseReport>

    Resolves with a CloseReport once all upstream iterators and finalizers have finished. Never rejects, and awaiting it does not trigger cancellation.

    • Returns AsyncIterableIterator<T, unknown, undefined>

    • Immediately requests cancellation without waiting for cleanup. Track teardown completion via closed.

      Parameters

      • Optionalreason: unknown

      Returns void

    • Parameters

      • ...__namedParameters: [] | [undefined]

      Returns Promise<IteratorResult<T, unknown>>

    • Stops the execution and waits for cleanup before resolving { done: true, value: undefined }. Rejects with the primary reason if the execution failed, including cleanup-only failure. After cancellation, resolves even if cleanup fails; inspect closed for suppressed errors.

      Parameters

      • Optionalvalue: unknown

      Returns Promise<IteratorResult<T, unknown>>

    • Requests failure without forwarding the throw into the upstream iterator and rejects immediately, without waiting for cleanup. Preserves an existing failure or cancellation reason; await closed for teardown completion.

      Parameters

      • Optionalerror: unknown

      Returns Promise<IteratorResult<T, unknown>>