Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Binary []byte RuntimeConfig wazero.RuntimeConfig )
Options for initializing wasm.
To use the default build:
import _ "github.com/pgaskin/go-libz/embed"
Functions ¶
func Compress ¶
Compress compresses src into dst, returning a slice pointing to the compressed data. If dst is nil, the maximum possible compressed length is allocated. Otherwise, if dst is too short, an error is returned.
func Initialize ¶
func Initialize() error
Initialize compiles the wasm binary.
This is called implicitly when used for the first time.
func Uncompress ¶
Uncompress decompresses src into dst, returning a slice pointing to the decompressed data. If dst is too short, an error is returned.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error wraps a libz error code.
type ErrorCode ¶
type ErrorCode int32
ErrorCode is a return status for the compression functions. Negative values are errors, positive value are for special but normal events.
When used as an error, Z_OK is returned as nil.
type Level ¶
type Level int32
Level is a compression level.
Note that this doesn't match the levels in compress/flate since [LevelNoCompression] is zero, and there's no equivalent for huffman-only.