API · Select

last()

Consume the complete source and emit its final successful value.

Signature

last(): Exstream<T, C>

Example

const latest = await exstream(records).last().value()

Behavior

last() retains one successful value and its context, replacing them as input arrives. It emits only when upstream ends. Empty input emits nothing. Order is therefore meaningful but output cannot begin early, and infinite sources never produce a result unless they are stopped.

Memory is constant apart from the retained value. Downstream pressure propagates normally while input is consumed. Existing record errors pass through immediately and do not replace the retained candidate; a handled error allows later values to continue.

Forms

stream.last()
exstream.pipeline().last()
exstream.last(stream)

head(), value(), reduce1()