TextDecodeBuffer
Defined in: packages/format-core/src/text-decode-buffer.ts:17
A DecodeBuffer that accepts byte chunks and windows them as text.
The Chunk/View split exists for exactly this: a decoder written against
string (NDJSON, CSV, INI) can be driven straight from a byte source without
the caller inserting a TextDecoderStream and without each format
hand-rolling its own driver wiring.
The TextDecoder is held across appends, so a multi-byte sequence split over
a chunk boundary is reassembled rather than replaced.
Implements
Section titled “Implements”DecodeBuffer<string,Uint8Array>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TextDecodeBuffer(
maxSize,encoding?):TextDecodeBuffer
Defined in: packages/format-core/src/text-decode-buffer.ts:26
Parameters
Section titled “Parameters”maxSize
Section titled “maxSize”number
Maximum retained code-unit count; must be greater than zero.
encoding?
Section titled “encoding?”string = "utf-8"
Label for the incoming bytes. Defaults to UTF-8.
Returns
Section titled “Returns”TextDecodeBuffer
Accessors
Section titled “Accessors”buffered
Section titled “buffered”Get Signature
Section titled “Get Signature”get buffered():
number
Defined in: packages/format-core/src/text-decode-buffer.ts:31
Unconsumed unit count currently held.
Returns
Section titled “Returns”number
Unconsumed unit count currently held.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”append()
Section titled “append()”append(
chunk):void
Defined in: packages/format-core/src/text-decode-buffer.ts:35
Append chunk, growing or compacting the backing as needed.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
void
Defined in: packages/format-core/src/text-decode-buffer.ts:57
Discard everything held.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”consume()
Section titled “consume()”consume(
count):void
Defined in: packages/format-core/src/text-decode-buffer.ts:48
Drop count units from the front.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”finish()
Section titled “finish()”finish():
void
Defined in: packages/format-core/src/text-decode-buffer.ts:40
Flush any bytes the decoder is holding back, at end of input.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”take()
Section titled “take()”take():
Uint8Array
Defined in: packages/format-core/src/text-decode-buffer.ts:53
Residue is re-encoded as UTF-8, whatever the input encoding was.
Returns
Section titled “Returns”Uint8Array
Implementation of
Section titled “Implementation of”view()
Section titled “view()”view():
string
Defined in: packages/format-core/src/text-decode-buffer.ts:44
Window over the unconsumed units. Invalidated by the next append or consume; copy before retaining.
Returns
Section titled “Returns”string