LineDecoder
Defined in: packages/format-core/src/codecs/line-decoder.ts:39
Decodes one string per \n-terminated line, stripping a preceding \r.
This is the read half of the framing used by SMTP, LMTP, IMAP, POP3, IRC and most other text command protocols. Stateful across partial lines, so an instance must back exactly one driver.
Implements
Section titled “Implements”Decoder<string>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LineDecoder(
encoding,options?):LineDecoder
Defined in: packages/format-core/src/codecs/line-decoder.ts:46
Parameters
Section titled “Parameters”encoding
Section titled “encoding”TextEncodingName
options?
Section titled “options?”Returns
Section titled “Returns”LineDecoder
Methods
Section titled “Methods”decode()
Section titled “decode()”decode(
view):DecodeResult<string>
Defined in: packages/format-core/src/codecs/line-decoder.ts:54
Attempt to decode one value from the front of view.
view is a window into the driver’s buffer and is invalidated as soon as
this call returns. Copy anything retained in the returned value.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”DecodeResult<string>
Implementation of
Section titled “Implementation of”reset()
Section titled “reset()”reset():
void
Defined in: packages/format-core/src/codecs/line-decoder.ts:98
Discard accumulated decode state ahead of a protocol mode switch.
Returns
Section titled “Returns”void