archive

package
v0.0.0-...-73ad954 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package archive implements a helper for extracting archives without needing to configure the extraction process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract

func Extract(opts ExtractOptions, dest string) error

Extract extracts an archive to the provided destination.

Types

type ExtractOptions

type ExtractOptions struct {
	// Reader is the io.Reader to read the archive from. Either [Reader]
	// or [Path] must be provided.
	Reader io.Reader

	// Extension is the extension of the archive to extract. This
	// overrides the extension detection from [Path] if provided. This is
	// required if [Reader] is provided.
	Extension string

	// Path is the path to the archive to extract. Either [Reader] or
	// [Path] must be provided.
	Path string
}

ExtractOptions contains the options for extracting an archive.

type Extractor

type Extractor interface {
	// Extract extracts all files from the provided reader to the
	// destination.
	Extract(r io.Reader, ext, dest string) error

	// Extensions should return a list of supported extensions for this
	// extractor.
	Extensions() []string
}

Extractor is an interface for extracting archives.

Jump to

Keyboard shortcuts

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