@kayahr/text-encoding
Version:
Text encoder and decoder
17 lines (16 loc) • 628 B
TypeScript
import type { ByteBuffer } from "./ByteBuffer.ts";
/** Decoder constructor type. */
export type DecoderConstructor = new (fatal?: boolean) => Decoder;
/**
* Interface for decoders.
*/
export interface Decoder {
/**
* Decodes the next code point(s) from the given buffer and returns it.
*
* @param buffer - The buffer containing the data to decode.
* @returns The next decoded code point(s), null if not enough data exists in the buffer to decode a complete
* code point, or FINISHED (-1) when decoding has been finished.
*/
decode(buffer: ByteBuffer): number | number[] | null;
}