gzip

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxDecompressSize = 100 * 1024 * 1024 * 1024 // 100 GB

Variables

This section is empty.

Functions

func Compress added in v1.4.0

func Compress(sourcePath string, targetFile *os.File) error

Compress compresses the sourcePath (which can be a file or a directory) into a gzip archive written to targetFile. It uses relative paths for the file headers within the archive to preserve the directory structure.

func Decompress

func Decompress(tarGzPath, destDir string) error

Decompress takes the path to a .tar.gz file and decompresses it into the specified directory.

func DecompressInPlace

func DecompressInPlace(tarGzPath string) (string, error)

DecompressInPlace takes the path to a .tar.gz file and decompresses it into the same directory.

func DecompressWithMaxBytes

func DecompressWithMaxBytes(tarGzPath, destDir string, maxDecompressSize int64) error

DecompressWithMaxBytes takes the path to a .tar.gz file and decompresses it into the specified directory. It enforces a maximum decompressed file size (per file) to prevent decompression bombs. TODO: Ignore linting issue for now. Fixing this is a task by itself

Types

This section is empty.

Jump to

Keyboard shortcuts

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