archive

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPath

func BuildPath(scheme, archivePath, inner string) string

BuildPath builds an archive URI from scheme, archive path, and inner path.

func EntryExt

func EntryExt(value string) string

EntryExt returns the file extension for the entry portion of an archive URI.

func IsArchivePath

func IsArchivePath(value string) bool

IsArchivePath reports whether the value is an archive URI.

func SplitPath

func SplitPath(value string) (scheme, archivePath, inner string, err error)

SplitPath parses an archive URI into scheme, archive path, and inner path.

Types

type Entry

type Entry struct {
	Name  string
	Path  string
	IsDir bool
}

Entry is a single file or directory within an archive.

type Handler

type Handler interface {
	Scheme() string
	IsArchivePath(path string) bool
	List(path string, showHidden bool) ([]Entry, error)
	Open(path string) (io.ReadCloser, error)
}

Handler manages a specific archive format (zip, tar, etc.).

func NewRarHandler

func NewRarHandler() Handler

func NewSevenZipHandler

func NewSevenZipHandler() Handler

func NewTarGzHandler

func NewTarGzHandler() Handler

func NewTarHandler

func NewTarHandler() Handler

func NewTarXzHandler

func NewTarXzHandler() Handler

func NewZipHandler

func NewZipHandler() Handler

type Registry

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

Registry is a collection of archive handlers.

func DefaultRegistry

func DefaultRegistry() *Registry

DefaultRegistry returns the shared registry of built-in handlers.

func (*Registry) FindHandler

func (r *Registry) FindHandler(path string) Handler

FindHandler returns a handler that recognizes the path.

func (*Registry) Register

func (r *Registry) Register(handler Handler)

Register adds a handler. Later handlers are checked after earlier ones.

Jump to

Keyboard shortcuts

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