{ } qjs-modules

textcode

Source: quickjs-textcode.c — module exports TextDecoder and TextEncoder

WHATWG-style text encoding/decoding, extended with endianness control and incremental (buffered) operation.

TextDecoder

new TextDecoder([encoding])   // length 1
MemberArgsKindDescription
decode(input)1methodDecodes bytes (ArrayBuffer/typed array) into a string.
encoding—getterThe label of the active encoding (enumerable).
endian—getterByte order used for multi-byte encodings.
buffered—getterBytes held back awaiting more input (incremental decode).

TextEncoder

new TextEncoder([encoding])   // length 1
MemberArgsKindDescription
encode(input)1methodEncodes a string into a Uint8Array.
encodeInto(source, dest)2methodEncodes source into the existing dest typed array; returns read/written counts.
encoding—getterThe label of the active encoding (enumerable).
endian—getterByte order used for multi-byte encodings.
buffered—getterBytes pending across incremental encode calls.