ndjson

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ndjson frames a newline-delimited JSON body into one raw stream frame per line: StreamFrame.Data is the line's bytes and Name is empty. Blank lines are skipped. It is byte-level wire framing only — it does not parse the JSON or know any LLM semantics; a semantic StreamDecoder interprets each line's Data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeStreamFrames

func DecodeStreamFrames(body io.ReadCloser) (*stream.StreamReader[stream.StreamFrame], error)

DecodeStreamFrames frames an NDJSON body into one StreamFrame per non-empty line. It owns body: the returned reader's Close closes body; on an early error (nil body) there is no body to close.

func Framer

func Framer() codec.StreamFramer

Framer returns the package's StreamFramer as an interface value, for callers that inject an codec.StreamFramer.

Types

type FramerError

type FramerError struct {
	Reason string
	Err    error
}

FramerError wraps a stream read failure surfaced while framing. Typed per the repo rule so callers can errors.As it and Unwrap the underlying I/O cause.

func (*FramerError) Error

func (e *FramerError) Error() string

func (*FramerError) Unwrap

func (e *FramerError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL