TypeScript API / laikacms/compat / collectStream
Function: collectStream()
ts
function collectStream<A, D>(stream, options?): Promise<{
done: D;
items: readonly A[];
}>;Collect all data items from a LaikaStream into an array and return { items, done } as a Promise. Rejects with the fatal LaikaError on failure.
Pass onProgress to receive each LaikaMetadata event (progress + recoverable errors) as the stream runs. Data elements are NOT forwarded to the callback — they are collected into items as usual.
This is a Promise-friendly entry point that does not require importing effect at the call site.
Type Parameters
| Type Parameter |
|---|
A |
D extends LaikaDone |
Parameters
| Parameter | Type |
|---|---|
stream | LaikaStream<A, D> |
options? | CompatOptions |
Returns
Promise<{ done: D; items: readonly A[]; }>