Documentation
    Preparing search index...

    Function toArray

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

      Type Parameters

      • T

      Parameters

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

      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.

      CATCH

      --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[]>

      STANDARD

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

      toArray(stream)

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