Skip to content

createNetstringDecoder

createNetstringDecoder(options?): Decoder<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>

Defined in: packages/format-netstring/src/netstring/netstring-decoder.ts:50

Creates the netstring read half: length:payload, in, payload bytes out.

Length-field violations are reported as recoverable errors — the decoder knows exactly how many bytes to discard, so framing resynchronises — while a missing terminator is fatal, because at that point the declared length cannot be trusted and frame synchronisation is lost.

The single implementation of the netstring read grammar; every other read face in this package is driven by it.

Spec: https://cr.yp.to/proto/netstrings.txt

NetstringDecoderOptions

Decoder<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>