• Consumes all chunks in the stream and resolves them as an array.

    Type Parameters

    • T

    Parameters

    • readableStream: ReadableStream<T>
    • options: ToArrayOptions & {
          catch: true;
      }

    Returns Promise<{
        error?: unknown;
        result: T[];
    }>

    Remarks

    Using the catch option will resolve whatever it has consumed before the error is thrown and return an object containing the result and the error.

    See

    Label

    CATCH

    Example

    --1--2--3--E--4--5--6--|

    toArray(stream, { catch: true })

    { result: [1, 2, 3], error: E }
  • Consumes all chunks in the stream and resolves them as an array.

    Type Parameters

    • T

    Parameters

    Returns Promise<T[]>

    See

    ToArrayOptions

    Label

    STANDARD

    Example

    --1--2--3--4--5--6--|

    toArray(stream)

    [1, 2, 3, 4, 5, 6]

Generated using TypeDoc