gcompress

package
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package gcompress provides kinds of compression algorithms for binary/bytes data.

Package gcompress provides kinds of compression algorithms for binary/bytes data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gzip

func Gzip(data []byte, level ...int) ([]byte, error)

Gzip compresses `data` using gzip algorithm. The optional parameter `level` specifies the compression level from 1 to 9 which means from none to the best compression.

Note that it returns error if given `level` is invalid.

func GzipFile

func GzipFile(src, dst string, level ...int) error

GzipFile compresses the file `src` to `dst` using gzip algorithm.

func UnGzip

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

UnGzip decompresses `data` with gzip algorithm.

func UnGzipFile

func UnGzipFile(src, dst string) error

UnGzipFile decompresses file `src` to `dst` using gzip algorithm.

func UnZipContent

func UnZipContent(data []byte, dest string, path ...string) error

UnZipContent decompresses `data` to `dest` using zip compressing algorithm. The parameter `path` specifies the unzipped path of `archive`, which can be used to specify part of the archive file to unzip.

Note that the parameter `dest` should be a directory.

func UnZipFile

func UnZipFile(archive, dest string, path ...string) error

UnZipFile decompresses `archive` to `dest` using zip compressing algorithm. The optional parameter `path` specifies the unzipped path of `archive`, which can be used to specify part of the archive file to unzip.

Note that the parameter `dest` should be a directory.

func UnZlib

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

UnZlib decompresses `data` with zlib algorithm.

func ZipPath

func ZipPath(paths, dest string, prefix ...string) error

ZipPath compresses `paths` to `dest` using zip compressing algorithm. The unnecessary parameter `prefix` indicates the path prefix for zip file.

Note that the parameter `paths` can be either a directory or a file, which supports multiple paths join with ','.

func ZipPathWriter

func ZipPathWriter(paths string, writer io.Writer, prefix ...string) error

ZipPathWriter compresses `paths` to `writer` using zip compressing algorithm. The unnecessary parameter `prefix` indicates the path prefix for zip file.

Note that the parameter `paths` can be either a directory or a file, which supports multiple paths join with ','.

func Zlib

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

Zlib compresses `data` with zlib algorithm.

Types

This section is empty.

Jump to

Keyboard shortcuts

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