Reads a set number of values from source, returning as an array. May contain empty values if desired values is not reached.
source
After the limit is reached (or source completes), source is unsubscribed from.
If no limit is set, it will read until source completes or maximumWait is reached. maximumWait is 10 seconds by default.
maximumWait
Use toArrayOrThrow to throw if desired limit is not reached.
// Read from `source` for 5 secondsconst data = await toArray()(source);// Read 5 items from `source`const data = await toArray({ limit: 5 })(source);// Read for 10sconst data = await toArray({ maximumWait: 10_1000 })(source); Copy
// Read from `source` for 5 secondsconst data = await toArray()(source);// Read 5 items from `source`const data = await toArray({ limit: 5 })(source);// Read for 10sconst data = await toArray({ maximumWait: 10_1000 })(source);
Reads a set number of values from
source
, returning as an array. May contain empty values if desired values is not reached.After the limit is reached (or
source
completes),source
is unsubscribed from.If no limit is set, it will read until
source
completes ormaximumWait
is reached.maximumWait
is 10 seconds by default.Use toArrayOrThrow to throw if desired limit is not reached.