untar

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: MIT Imports: 8 Imported by: 8

README

Package untar provides helper function to easily extract contents of a tar stream to a file system directory. Useful for cases where you'd want a call to tar x.

See documentation for usage and example command in cmd/untar subdirectory.

Documentation

Overview

Package untar provides helper function to easily extract contents of a tar stream to a file system directory.

Useful for cases where you'd want a replacement for external call to `tar x`. It differs from `tar x` call by not setting proper times on symlinks itself. Extended attributes are not supported.

It's tested on OS X and Linux amd64 and is enough to unpack linux root filesystem to a useable state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Untar

func Untar(f io.Reader, dst string) error

Untar extracts each item from a tar stream and saves it into file system directory. It stops on first error it encounters; if extracted over existing file system tree, matching files would be overwritten. If destination directory does not exist, it will be created.

Note that permissions on unpacked data would be set with current umask taken into account; if you expect to get exact permissions, call syscall.Umask(0) beforehand. This function does not call it itself as this changes umask process-wide, so it's safer to do this explicitly.

Owner/group of extracted files are set only if run as root (os.Getuid() == 0) and are only set as numeric values, user/group names are not taken into account.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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