tarfs

package
v0.6.15 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package tarfs extracts tar streams into a directory safely, with optional OCI image-layer (whiteout) semantics.

All extraction rejects entries that would escape the destination directory via ".." traversal or symlinked parents (Zip Slip). Unpack extracts a plain (optionally gzipped) tar; UnpackLayer additionally applies OCI whiteouts so a sequence of UnpackLayer calls into the same directory reconstructs an image rootfs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unpack

func Unpack(ctx context.Context, r io.Reader, dest string) error

Unpack extracts the tar stream in r into dest. If the stream is gzipped it is decompressed first. Entries that would escape dest are rejected.

func UnpackLayer

func UnpackLayer(ctx context.Context, r io.Reader, dest string) error

UnpackLayer is like Unpack but applies OCI whiteouts: an entry named ".wh.<name>" deletes the sibling <name> already present in dest, and an entry named ".wh..wh..opq" clears the existing contents of its directory. Applying image layers in order with UnpackLayer reconstructs the merged rootfs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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