gz

package
v0.0.0-...-45da7de Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gzip

func Gzip(data []byte) ([]byte, error)
Example
// define original data
data := []byte(`MyzYrIyMLyNqwDSTBqSwM2D6KD9sA8S/d3Vyy6ldE+oRVdWyqNQrjTxQ6uG3XBOS0P4GGaIMJEPQ/gYZogwkQ+A0/gSU03fRJvdhIGQ1AMARVdWyqNQrjRFV1bKo1CuNEVXVsqjUK40RVdWyqNQrjRFV1bKo1CuNPmQF870PPsnSNeKI1U/MrOA0/gSU03fRb2A3OsnORNIruhCUYTIrOMTNU7JuGb5RSYJxa6PiMHdiRmFtXLNoY+GVmTD7aOV/K1yo4y0dR7Q=`)

// compress data
compressedData, compressedDataErr := Gzip(data)
if compressedDataErr != nil {
	log.Fatal(compressedDataErr)
}

// uncompress data
uncompressedData, uncompressedDataErr := Ungzip(compressedData)
if uncompressedDataErr != nil {
	log.Fatal(uncompressedDataErr)
}

fmt.Println("check equal:", bytes.Equal(data, uncompressedData))
Output:

check equal: true

func Ungzip

func Ungzip(data []byte) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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