expand

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package expand defines the Expander interface and a registry of expanders for compressed files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCompressedFile

func IsCompressedFile(filePath string) (bool, error)

IsCompressedFile reports whether the file at filePath begins with a known compression magic number.

func IsTarFile

func IsTarFile(filePath string) (bool, error)

IsTarFile checks whether the file at filePath is a tar archive by reading the standard tar magic bytes at offset 257 ("ustar\0" or "ustar ").

func RegisterExpander

func RegisterExpander(e Expander)

RegisterExpander adds an Expander to the global registry.

Types

type ExpandOptions

type ExpandOptions struct{}

ExpandOptions holds configuration options for expansion operations.

type Expander

type Expander interface {
	Expand(ctx context.Context, source string, destination string, umask os.FileMode) error
	Matcher(extension string) bool
}

Expander defines the interface for extracting compressed archives.

func GetExpander

func GetExpander(extension string) Expander

GetExpander returns the first registered Expander whose Matcher accepts the given extension.

Directories

Path Synopsis
Package bzip2 implements an Expander for standalone bzip2 compressed files.
Package bzip2 implements an Expander for standalone bzip2 compressed files.
Package tar implements an Expander for tar archives, including gzip and bzip2 compressed variants.
Package tar implements an Expander for tar archives, including gzip and bzip2 compressed variants.
Package zip implements an Expander for ZIP archives.
Package zip implements an Expander for ZIP archives.

Jump to

Keyboard shortcuts

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