gleamlz_string

Types

pub type DecompressError {
  EInvalidInput
}

Constructors

  • EInvalidInput

Functions

pub fn compress_to_base64(string: String) -> String

Compress a string into an ASCII base64 encoded representation

Example

let compressed = compress_to_base64(string: "Hello World")
pub fn compress_to_encoded_uri(string: String) -> String

Compress a string into ASCII representing the original string with a few changes to make it URI safe

Example

let compressed = compress_to_encoded_uri(string: "Hello World")
pub fn compress_to_uint8(string: String) -> BitArray

Compress a string to a BitArray

Example

let compressed = compress_to_uint8(string: "Hello World")
pub fn decompress_from_base64(
  base64_string: String,
) -> Result(String, DecompressError)

Decompress an lz-string base64 string back to the original UTF16 string

Example

let assert Ok(decompressed) = decompress_from_base64(base64_string: "BYUwNmD2A0AECWsCGBbZtDUzkAA=")
pub fn decompress_from_encoded_uri(
  uri_string: String,
) -> Result(String, DecompressError)

Decompress an lz-string URI string back to the original UTF16 string

Example

let assert Ok(decompressed) = decompress_from_encoded_uri(uri_string: "BYUwNmD2A0AECWsCGBbZtDUzkAA$")
pub fn decompress_from_uint8(
  bits: BitArray,
) -> Result(String, DecompressError)

Decompress an lz-string BitArray back to the original UTF16 string

Example

let assert Ok(decompressed) = decompress_from_uint8(bits: <<5, 132, 178, 0>>)
Search Document