arc

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 9 Imported by: 2

README

arc

arc is a pure Go library for creating, extracting, and managing archives. Based on mholt/archives and inspired by now-deprecated arc in archiver/v3.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArchivalMap = map[string]archives.Archival{
	"tar": archives.Tar{},
	"zip": archives.Zip{},
}
View Source
var CompressionMap = map[string]archives.Compression{
	"gz":  archives.Gz{},
	"bz2": archives.Bz2{},
	"xz":  archives.Xz{},
	"zst": archives.Zstd{},
	"lz4": archives.Lz4{},
	"br":  archives.Brotli{},
}

Maps to handle compression and archival types

View Source
var DEBUG = os.Getenv("ARC_DEBUG") == "true"

Functions

func Archive

func Archive(ctx context.Context, dir, outfile string, compression archives.Compression, archival archives.Archival) error

Archive is a function that archives the files in a directory dir: the directory to Archive outfile: the output file compression: the compression to use (gzip, bzip2, etc.) archival: the archival to use (tar, zip, etc.)

func ArchiveFiles added in v0.0.2

func ArchiveFiles(ctx context.Context, files []archives.FileInfo, outfile string, compression archives.Compression, archival archives.Archival) error

func Compress

func Compress(data []byte, compression archives.Compression) ([]byte, error)

Compress compresses input data using specified compressor.

func CompressBz2

func CompressBz2(data []byte) ([]byte, error)

CompressBz2 compresses input data using BZ2 compressor.

func CompressXz

func CompressXz(data []byte) ([]byte, error)

CompressXz compresses input data using XZ compressor.

func Decompress

func Decompress(data []byte, compression archives.Compression) ([]byte, error)

Decompress decompresses input compressed data.

func DecompressBz2

func DecompressBz2(data []byte) ([]byte, error)

DecompressBz2 decompresses input compressed data using BZ2 decompressor.

func DecompressXz

func DecompressXz(data []byte) ([]byte, error)

DecompressXz decompresses input compressed data using XZ decompressor.

func MakeFilesMap added in v0.0.2

func MakeFilesMap(ctx context.Context, files []string, trimDir string) ([]archives.FileInfo, error)

func Unarchive

func Unarchive(ctx context.Context, tarball, dst string) error

Unarchive unarchives a tarball to a directory, symlinks and hardlinks are ignored.

Types

This section is empty.

Directories

Path Synopsis
cmd
arc command
compressor command

Jump to

Keyboard shortcuts

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