gziputil

package
v0.64.4 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(w io.Writer, r io.Reader, level int) error

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

func CompressBase64JSON(data any, level int) (string, error)

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

func CompressBytes added in v0.64.4

func CompressBytes(data []byte, level int) ([]byte, error)

CompressBytes performs gzip compression on a byte slice.

func CompressToBase64String added in v0.64.4

func CompressToBase64String(data []byte, level int) (string, error)

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

func FixCompressLevel

func FixCompressLevel(level int) int

func Uncompress

func Uncompress(w io.Writer, r io.Reader) error

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

func UncompressBase64JSON

func UncompressBase64JSON(compressedB64 string, data any) error

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

func UncompressBase64String

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

UncompressBase64String base 64 decodes an input string and then gunzips the results. Base64 strings start with `H4sI` to `H4sIAAAAAAAAA`.

func UncompressBytes added in v0.64.4

func UncompressBytes(b []byte) ([]byte, error)

func UncompressToBytes added in v0.64.4

func UncompressToBytes(r io.Reader) ([]byte, error)

UncompressBytes gunzips a byte slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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