tarski

package module
v0.0.0-...-94b3b52 Latest Latest
Warning

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

Go to latest
Published: May 30, 2016 License: Apache-2.0 Imports: 11 Imported by: 1

README

Build Status GoDoc

Package tarski provides functions to create and extract tar archives. Content based hashes of tar archives can be created during extraction or creation of the underlying tar stream.

Documentation

Overview

Package tarski implements a simple library to deal with the creation and extraction of tar archives and allows for content hashes.

Content hashes are created based on the tar stream. That is to say the hash is based on the content of all files that are copied into the tar archive.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(archive string, path string, prefix string) (err error)

Create creates a tar archive. The string given by prefix will be stripped from all entries found under path.

func CreateSHA256

func CreateSHA256(archive string, path string, prefix string) (checksum []byte, err error)

CreateSHA256 creates a tar archive and returns its SHA256-hash checksum. The SHA256 hash of the tar archive is created based on the tar stream and not simply on the resulting archive. This is a proper content hash. The string given by prefix will be stripped from all entries found under path.

func Extract

func Extract(archive string, path string) error

Extract extracts a tar archive under path.

func ExtractDev

func ExtractDev(path string, h *tar.Header) (err error)

ExtractDev extracts a device file from a tar archive.

func ExtractDir

func ExtractDir(path string, h *tar.Header) (err error)

ExtractDir extracts a directory from a tar archive.

func ExtractReg

func ExtractReg(path string, h *tar.Header, r *tar.Reader) (err error)

ExtractReg extracts a regular file from a tar archive.

func ExtractSHA256

func ExtractSHA256(archive string, path string) (checksum []byte, err error)

ExtractSHA256 extracts a tar archive under path and returns its SHA256-hash checksum. The SHA256 hash of the tar archive is created based on the tar stream and not simply on the resulting archive. This is a proper content hash.

func ExtractSymlink(path string, h *tar.Header) (err error)

ExtractSymlink extracts a symbolic link from a tar archive.

func GetAllXattr

func GetAllXattr(path string) (xattrs map[string]string, err error)

GetAllXattr retrieves all extended attributes associated with a file, directory or symbolic link.

func IsEmpty

func IsEmpty(archive string) (bool, error)

IsEmpty detects empty tar archives.

func WriteHeader

func WriteHeader(w *tar.Writer, path string, entry string, f os.FileInfo) (err error)

WriteHeader writes a tar header. Deals with symbolic links and extended attributes. The entry argument will become the name of the file, directory, etc. in the tar header.

Types

This section is empty.

Jump to

Keyboard shortcuts

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