archive

package
v1.11.13 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package archive handles collections of files that are either packed together or packed and compressed.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrArchive = errors.New("format specified by source filename is not an archive format")
	ErrDir     = errors.New("is a directory")
	ErrFile    = errors.New("no such file")
	ErrWriter  = errors.New("writer must be a file object")
)

Functions

func Compress

func Compress(w io.Writer, files []string) error

Compress a collection of files using gzip and add them to the tar writter.

func Copy

func Copy(name, dest string) (int64, error)

Copy copies a file to the destination.

func Delete

func Delete(files []string) error

Delete removes the collection of files from the host filesystem.

func Extractor

func Extractor(name, src, target, dest string) error

Extractor extracts the named file from the given archive file into the destination folder. The archive format is selected implicitly. Archiver relies on the filename extension to determine which decompression format to use, which must be supplied using filename.

func Move

func Move(name, dest string) (int64, error)

Move copies a file to the destination and then deletes the source.

func NFO

func NFO(name string, files ...string) string

NFO attempts to discover a archive package NFO or information textfile from a collection of files. For better results the name of the archive file should be provided.

func Read

func Read(w io.Writer, src, name string) ([]string, string, error)

Read returns both a list of files within an rar, tar, zip or 7z archive; as-well as a suitable filename string for the archive. This filename is useful when the original archive filename has been given an invalid file extension. src is the absolute path to the archive file named as a unique id. name is the original archive filename and file extension.

func Readr

func Readr(w io.Writer, src, filename string) ([]string, string, error)

Readr returns both a list of files within an rar, tar or zip archive, and a suitable archive filename string. If there are problems reading the archive due to an incorrect filename extension, the returned filename string will be corrected.

func Restore

func Restore(w io.Writer, src, name, dest string) ([]string, error)

Restore unpacks or decompresses a given archive file to the destination. The archive format is selected implicitly. Restore relies on the filename extension to determine which decompression format to use, which must be supplied using filename. src is the absolute path to the archive file named as a unique id. filename is the original archive filename and file extension.

func Store

func Store(w io.Writer, files []string) error

Store adds collection of files to the tar writer.

func Unarchiver

func Unarchiver(src, dest, filename string) error

Unarchiver decompresses the given archive file into the destination folder. The archive format is selected implicitly. Archiver relies on the filename extension to determine which decompression format to use, which must be supplied using filename.

Types

type Demozoo

type Demozoo struct {
	Source   string
	UUID     string
	VarNames *[]string
	Config   conf.Config
}

func (Demozoo) Decompress added in v1.11.0

func (z Demozoo) Decompress(db *sql.DB, w io.Writer) (demozoo.Data, error)

Demozoo decompresses and parses archives fetched from https://demozoo.org.

type Proof

type Proof struct {
	Source string
	Name   string
	UUID   string
	Config conf.Config
}

func (Proof) Decompress added in v1.11.0

func (p Proof) Decompress(w io.Writer) error

Proof decompresses and parses a hosted file archive. src is the path to the file including the uuid filename. filename is the original archive filename, usually kept in the database. uuid is used to rename the extracted assets such as image previews.

Directories

Path Synopsis
internal
arc
Package arc handles interactions with the mholt archiver package.
Package arc handles interactions with the mholt archiver package.
content
Package content stats the content of an archive.
Package content stats the content of an archive.
demozoo
Package demozoo handles downloads fetched from Demozoo Productions links.
Package demozoo handles downloads fetched from Demozoo Productions links.
file
Package file handles common file system operations such as move, copy and dir.
Package file handles common file system operations such as move, copy and dir.
sys
Package sys uses programs installed to the host operating system to handle miscellaneous archives not usable with the Go packages.
Package sys uses programs installed to the host operating system to handle miscellaneous archives not usable with the Go packages.
task
Package task handles the scanning of directories for release proofs.
Package task handles the scanning of directories for release proofs.

Jump to

Keyboard shortcuts

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