Consumes all chunks in the stream and resolves them as an array.
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
CATCH
--1--2--3--E--4--5--6--|toArray(stream, { catch: true }){ result: [1, 2, 3], error: E } Copy
--1--2--3--E--4--5--6--|toArray(stream, { catch: true }){ result: [1, 2, 3], error: E }
Optional
ToArrayOptions
STANDARD
--1--2--3--4--5--6--|toArray(stream)[1, 2, 3, 4, 5, 6] Copy
--1--2--3--4--5--6--|toArray(stream)[1, 2, 3, 4, 5, 6]
Consumes all chunks in the stream and resolves them as an array.