archive

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAlgorithm = errors.New("invalid algorithm")
)

Functions

This section is empty.

Types

type Algorithm added in v1.15.0

type Algorithm uint8
const (
	None Algorithm = iota
	Tar
	Zip
)

func Detect added in v1.15.0

Detect will try to detect the algorithm of the input and returns the corresponding reader. This function will read the first 6 bytes of the input and try to detect the algorithm. If algorithm detection trigger a supported algorithm, the function will try to convert the input to appropriate reader for the archive. In any case, if en error occurs, the function will return an error. Otherwise, the function will return the algorithm, the reader and a nil error.

If the input is a zip archive and the input is not a io.ReaderAt compatible, the function will return. If the input is a tar archive and the input is a strict io.ReadCloser, with no seek or read at compatible, the reader result could be use only for one time.

This difference are based on how the algorithm work: - zip: will use dictionary / catalog to store position and metadata of each embedded file - tar: (TAR = Tape ARchive) will store each file continuously beginning with his metadata and following with his content.

As that, a strict reader could be use only for tar archive and the reader result could be use only for one time. In this case, the best use if calling the walk function of the reader.

func Parse added in v1.15.0

func Parse(s string) Algorithm

func (Algorithm) DetectHeader added in v1.15.0

func (a Algorithm) DetectHeader(h []byte) bool

func (Algorithm) Extension added in v1.15.0

func (a Algorithm) Extension() string

func (Algorithm) IsNone added in v1.15.0

func (a Algorithm) IsNone() bool

func (Algorithm) MarshalJSON added in v1.15.0

func (a Algorithm) MarshalJSON() ([]byte, error)

func (Algorithm) MarshalText added in v1.15.0

func (a Algorithm) MarshalText() ([]byte, error)

func (Algorithm) Reader added in v1.15.0

func (a Algorithm) Reader(r io.ReadCloser) (arctps.Reader, error)

func (Algorithm) String added in v1.15.0

func (a Algorithm) String() string

func (*Algorithm) UnmarshalJSON added in v1.15.0

func (a *Algorithm) UnmarshalJSON(b []byte) error

func (*Algorithm) UnmarshalText added in v1.15.0

func (a *Algorithm) UnmarshalText(b []byte) error

func (Algorithm) Writer added in v1.15.0

func (a Algorithm) Writer(w io.WriteCloser) (arctps.Writer, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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