View Source LZString (lz_string v0.0.8)

Link to this section Summary

Functions

Compresses the given String with the lz-string algorithm.

Compresses the given string and base64 encodes it.

Compresses the given string and base64 encodes it, substituting uri-unsafe characters.

Decodes the given "base64" string, giving a naked lz-string bitstring.

Decodes the given "uri encoded" base64 string, giving a naked lz-string bitstring.

Decompresses the given binary with the lz-string algorithm.

Decompresses the given string after decoding lz-string's non-standard base64.

Decompresses the given "uri encoded" base64 compressed string.

Link to this section Functions

@spec compress(String.t()) :: binary()

Compresses the given String with the lz-string algorithm.

 iex> LZString.compress("hello, i am a 猫")
 <<5, 133, 48, 54, 96, 246, 3, 64, 4, 9, 107, 2, 24, 22, 217, 180, 53, 51, 144, 0>>

Compresses the given string and base64 encodes it.

iex> LZString.compress_base64("hello, i am a 猫")
"BYUwNmD2A0AECWsCGBbZtDUzkAA="
Link to this function

compress_uri_encoded(str)

View Source

Compresses the given string and base64 encodes it, substituting uri-unsafe characters.

iex> LZString.compress_uri_encoded("hello, i am a 猫") "BYUwNmD2A0AECWsCGBbZtDUzkAA$"

Decodes the given "base64" string, giving a naked lz-string bitstring.

iex> LZString.decode_base64("BYUwNmD2A0AECWsCGBbZtDUzkA==") <<5, 133, 48, 54, 96, 246, 3, 64, 4, 9, 107, 2, 24, 22, 217, 180, 53, 51, 144, 0, 0>>

Decodes the given "uri encoded" base64 string, giving a naked lz-string bitstring.

iex> LZString.decode_uri_encoded("BYUwNmD2A0AECWsCGBbZtDUzkA$$") <<5, 133, 48, 54, 96, 246, 3, 64, 4, 9, 107, 2, 24, 22, 217, 180, 53, 51, 144, 0, 0>>

@spec decompress(binary()) :: String.t()

Decompresses the given binary with the lz-string algorithm.

iex> LZString.decompress(<<5, 133, 48, 54, 96, 246, 3, 64, 4, 9, 107, 2, 24, 22, 217, 180, 53, 51, 144, 0>>) "hello, i am a 猫"

Link to this function

decompress(w, str, dict)

View Source

Decompresses the given string after decoding lz-string's non-standard base64.

iex> LZString.decompress_base64("BYUwNmD2A0AECWsCGBbZtDUzkA==")
"hello, i am a 猫"
Link to this function

decompress_uri_encoded(str)

View Source

Decompresses the given "uri encoded" base64 compressed string.

iex> LZString.decompress_uri_encoded("BYUwNmD2A0AECWsCGBbZtDUzkAA$") "hello, i am a 猫"