Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetInnerExtension ¶
GetInnerExtension returns the extension of the uncompressed file e.g., "data.csv.gz" -> ".csv"
func GetUncompressedPath ¶
GetUncompressedPath returns the path without the compression extension e.g., "data.csv.gz" -> "data.csv"
func IsCompressed ¶
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