extract

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package extract unpacks tar archives (optionally xz- or gzip-compressed) and writes each regular file into a destination directory, optionally recompressing members with gzip or xz. Member paths are validated against directory traversal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsArchive

func IsArchive(name string) bool

IsArchive reports whether name looks like a tar archive this package can extract: .tar, .tar.gz, .tgz, or .tar.xz.

Types

type Result

type Result struct {
	Files int   // regular files written
	Bytes int64 // total bytes written to disk (post-recompression)
}

Result summarises a single archive extraction.

func Archive

func Archive(archivePath, destDir, comp string) (Result, error)

Archive extracts every regular file from archivePath into destDir, recompressing each member according to comp ("none", "gz", or "xz"). The outer compression is detected from archivePath's extension.

Jump to

Keyboard shortcuts

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