API · Select
head()
Emit the first successful value and stop this branch.
Signature
head(): Exstream<T, C> Example
const first = await exstream(source).head().value() Behavior
head() is exactly take(1). Empty input produces no value. It preserves the first value’s context, adds no queue, and releases its upstream consumer after the first successful value. Existing record errors pass through and do not satisfy the limit; an error policy may handle them before a later value becomes the head.
Because range termination is detected on the next successful input, the source can be asked for one additional value that is not emitted. For side-effecting sources, account for that pull behavior.
Forms
stream.head()
exstream.pipeline().head()
exstream.head(stream)