tuil
ReferencePackages

@mwillbanks/tuil-streaming

Extensible backpressure-aware streaming parsers, transformers, and projections for tuil.

View rawEdit

Overview

Extensible backpressure-aware streaming parsers, transformers, and projections for tuil.

@mwillbanks/tuil-streaming is independently installable and also participates in the umbrella @mwillbanks/tuil runtime where applicable.

Installation

npm install @mwillbanks/tuil-streaming

How it operates

Streaming pipelines incrementally decode and parse common text formats with cancellation, backpressure, transforms, projections, diagnostics, bounded source, and replay.

Documentation flow diagram. decode chunks; parse partials; transform/project; end/cancel; S0 leads to S1; S1 leads to S2; S2 leads to S3
Documentation flow diagram. decode chunks; parse partials; transform/project; end/cancel; S0 leads to S1; S1 leads to S2; S2 leads to S3

API

APISignatureDescription
BackpressureControllerinterface BackpressureControllerPublic interface BackpressureController.
BoundedBackpressureControllerclass BoundedBackpressureControllerPublic class BoundedBackpressureController.
builtInDocumentTransformersconstant builtInDocumentTransformersPublic constant builtInDocumentTransformers.
builtInFormatParsersconstant builtInFormatParsersPublic constant builtInFormatParsers.
builtInRenderProjectionsconstant builtInRenderProjectionsPublic constant builtInRenderProjections.
DocumentNodeinterface DocumentNodePublic interface DocumentNode.
DocumentTransformerinterface DocumentTransformerPublic interface DocumentTransformer.
FormatParserinterface FormatParserPublic interface FormatParser.
FormatParserSessioninterface FormatParserSessionPublic interface FormatParserSession.
ParserDiagnosticinterface ParserDiagnosticPublic interface ParserDiagnostic.
PartialDocumentinterface PartialDocumentPublic interface PartialDocument.
RenderProjectioninterface RenderProjectionPublic interface RenderProjection.
SourceSpaninterface SourceSpanPublic interface SourceSpan.
StreamDecoderinterface StreamDecoderPublic interface StreamDecoder.
StreamEventtype StreamEventPublic type StreamEvent.
StreamRendererinterface StreamRendererPublic interface StreamRenderer.
Utf8StreamDecoderclass Utf8StreamDecoderPublic class Utf8StreamDecoder.

Events and lifecycle

Typed start, document, diagnostic, and end events carry monotonically increasing sequence numbers.

All subscriptions and registrations return a disposer or belong to an owning runtime that disposes them in reverse order.

Example

const pipeline = new StreamingPipeline({ format: "jsonl" });
await pipeline.write(chunk);

On this page