gziputil

package
v0.26.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(data []byte, level int) []byte

Compress performs gzip compression on a byte slice.

func CompressBase64

func CompressBase64(data []byte, level int) string

CompressBase64 performs gzip compression and then base64 encodes the data. Level includes `compress/gzip.BestSpeed`, `compress/gzip.BestCompression`, and `compress/gzip.DefaultCompression`.

func CompressBase64JSON

func CompressBase64JSON(data interface{}, level int) (string, error)

CompressBase64JSON performs a JSON encoding, gzip compression and then base64 encodes the data.

func CompressWriter

func CompressWriter(w io.Writer, data []byte, level int) error

CompressWriter compresses a byte slide and writes the results to the supplied `io.Writer`. When writing to a file, a `*os.File` from `os.Create()` can be used as the `io.Writer`.

func FixCompressLevel

func FixCompressLevel(level int) int

func Uncompress

func Uncompress(compressed []byte) ([]byte, error)

Uncompress gunzips a byte slice.

func UncompressBase64

func UncompressBase64(compressedB64 string) ([]byte, error)

UncompressBase64 base 64 decodes an input string and then gunzips the results.

func UncompressBase64JSON

func UncompressBase64JSON(compressedB64 string, data interface{}) error

UncompressBase64JSON JSON encodes data, compresses it and then base 64 compresses the data.

func UncompressBase64String

func UncompressBase64String(compressedB64 string) (string, error)

UncompressBase64String base 64 decodes an input string and then gunzips the results, returning a decoded string.

func UncompressWriter

func UncompressWriter(w io.Writer, compressed []byte) error

UncompressWriter gunzips a byte slice and writes the results to a `io.Writer`

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL