Documentation
¶
Overview ¶
This package provides encoding and decoding of lzstring data.
lzstring is a custom javascript string compression format. See following URL for details on lzstring.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotDecodable = errors.New("input not decodable") ErrEmptyInput = errors.New("empty input") )
Functions ¶
func CompressToBase64 ¶
compress a string as lzstring, then encode with base64.
Example ¶
package main
import (
"fmt"
lzstring "github.com/mixcode/golib-lzstring"
)
func main() {
text := "I have some string to be compressed"
fmt.Println(lzstring.CompressToBase64(text))
}
Output: JIAgFghgbgpiDOB7AtneAXATgSwHYHMR1EQAjOAYxQAdMZ54YATIAA==
func Decompress ¶ added in v0.0.2
decompress raw lzstring bytes.
func DecompressBase64 ¶
decompress base64 encoded lzstring.
Example ¶
package main
import (
"fmt"
lzstring "github.com/mixcode/golib-lzstring"
)
func main() {
base64text := "JIAgFghgbgpiDOB7AtneAXATgSwHYHMR1EQAjOAYxQAdMZ54YATIAA=="
decompressed, err := lzstring.DecompressBase64(base64text)
if err != nil {
panic(err)
}
fmt.Println(decompressed)
}
Output: I have some string to be compressed
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.