lz_string v0.0.7 LZString

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

Functions

compress(str)
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>>
compress(w, arg2, dict)
compress_base64(str)

Compresses the given string and base64 encodes it.

iex> LZString.compress_base64("hello, i am a 猫")
"BYUwNmD2A0AECWsCGBbZtDUzkAA="
compress_uri_encoded(str)

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

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

debug(bitstring)
decode_base64(str)

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>>

decode_uri_encoded(str)

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>>

decompress(str)
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 猫”

decompress(w, str, dict)
decompress_base64(str)

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

iex> LZString.decompress_base64("BYUwNmD2A0AECWsCGBbZtDUzkA==")
"hello, i am a 猫"
decompress_uri_encoded(str)

Decompresses the given “uri encoded” base64 compressed string.

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