gossamer/text_decoder

Types

pub type TextDecoder
pub type TextDecoderOption {
  Fatal
  IgnoreBom
}

Constructors

  • Fatal

    When set, decoding invalid data returns an error instead of substituting malformed data with a replacement character.

  • IgnoreBom

    Indicates whether the byte order mark will be included in the output or skipped over. It defaults to false, which means that the byte order mark will be skipped over when decoding and will not be included in the decoded text.

Values

pub fn decode(input: array_buffer.ArrayBuffer) -> String

Turns binary data, often in the form of a Uint8Array, into a string given the encoding.

pub fn decode_chunk(
  decoder: TextDecoder,
  input: array_buffer.ArrayBuffer,
) -> Result(String, String)
pub fn decode_with(
  input: array_buffer.ArrayBuffer,
  label: String,
  with options: List(TextDecoderOption),
) -> Result(String, String)
pub fn encoding(of decoder: TextDecoder) -> encoding.Encoding
pub fn flush(decoder: TextDecoder) -> Result(String, String)
pub fn is_fatal(decoder: TextDecoder) -> Bool
pub fn is_ignore_bom(decoder: TextDecoder) -> Bool
pub fn new() -> TextDecoder
pub fn new_with(
  label: String,
  with options: List(TextDecoderOption),
) -> Result(TextDecoder, String)
Search Document