compressionhandler

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInnerExtension

func GetInnerExtension(filePath string) string

GetInnerExtension returns the extension of the uncompressed file e.g., "data.csv.gz" -> ".csv"

func GetUncompressedPath

func GetUncompressedPath(filePath string) string

GetUncompressedPath returns the path without the compression extension e.g., "data.csv.gz" -> "data.csv"

func IsCompressed

func IsCompressed(filePath string) bool

IsCompressed checks if a file path has a compression extension

func SupportedCompressions

func SupportedCompressions() []string

SupportedCompressions returns a list of supported compression formats

Types

type Compression

type Compression string

Compression represents a supported compression format

const (
	CompressionNone  Compression = ""
	CompressionGzip  Compression = "gzip"
	CompressionBzip2 Compression = "bzip2"
	CompressionXZ    Compression = "xz"
	CompressionZstd  Compression = "zstd"
)

func DetectCompression

func DetectCompression(filePath string) Compression

DetectCompression detects if a file is compressed and returns the compression type

type CompressionHandler

type CompressionHandler struct {
	// contains filtered or unexported fields
}

CompressionHandler handles decompression of compressed files

func NewCompressionHandler

func NewCompressionHandler() *CompressionHandler

NewCompressionHandler creates a new compression handler

func (*CompressionHandler) Cleanup

func (h *CompressionHandler) Cleanup() error

Cleanup removes all temporary decompressed files

func (*CompressionHandler) GetOriginalPath

func (h *CompressionHandler) GetOriginalPath(decompressedPath string) string

GetOriginalPath returns the original path for a decompressed file path If the path was not decompressed, returns the same path

func (*CompressionHandler) GetPathMapping

func (h *CompressionHandler) GetPathMapping() map[string]string

GetPathMapping returns a map of decompressed path -> original path Only includes entries for files that were actually decompressed

func (*CompressionHandler) ResolveFiles

func (h *CompressionHandler) ResolveFiles(files []string) ([]string, error)

ResolveFiles decompresses any compressed files and returns paths to the decompressed versions Non-compressed files are returned as-is

Jump to

Keyboard shortcuts

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