tarx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package tarx packs a directory to a tar.gz stream and safely unpacks one — archive/tar gives the container format but leaves the two loops everyone re-writes (walk-and-add, extract-without-zip-slip) to the caller, and the extraction loop is famously easy to get wrong.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PackDir

func PackDir(dir string, w io.Writer, skip func(rel string) bool) error

PackDir writes dir as a tar.gz stream to w. Entries are relative to dir; regular files, directories and symlinks are kept (sockets/devices skipped — they're runtime state, not data). Entries for which skip returns true are omitted (nil = keep everything); a skipped directory prunes its subtree.

func UnpackDir

func UnpackDir(r io.Reader, dir string) error

UnpackDir extracts a tar.gz stream into dir, refusing entries that would escape it (zip-slip) — treat any archive that has been at rest elsewhere as crossing a trust boundary. Symlinks are confined by what they RESOLVE to, not just their text.

Types

This section is empty.

Jump to

Keyboard shortcuts

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