API · Formats

split()

Decode chunks incrementally and emit text separated by Unix or Windows line endings.

Signature

split(encoding?: string): Exstream<string, C>

Example

const lines = exstream(response.body).split('utf8')

Parameters

encoding

Type stringDefault 'utf8'

Text decoder encoding supported by the active runtime.

Records

split() is splitBy(/\r?\n/, encoding). Separators may span chunk boundaries, and multibyte characters are preserved by the incremental decoder. Delimiters are removed. When input ends, the remaining buffer is always emitted, including an empty string after a trailing newline and for empty decoded input.

Order and context are preserved. The operator buffers only the incomplete current line, which can grow without bound when input contains no newline. Record errors pass through without clearing that buffer.

Errors

Unsupported encodings throw at operator creation. Invalid chunks or decoder failures become processing errors according to the runtime codec. Use parser-specific size limits when accepting untrusted records.

Forms

stream.split()
exstream.pipeline().split('utf8')
exstream.split('utf8', stream)
stream.through(exstream.split())

splitBy(), csv(), jsonl()