tar

package
v2.0.0-...-eedbe7b Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: LGPL-3.0 Imports: 11 Imported by: 1

Documentation

Overview

This package provides convenience helpers on top of archive/tar to be able to tar/untar files with a functionality closer to gnu tar command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindFile

func FindFile(tarFile io.Reader, filename string) (*tar.Header, io.Reader, error)

FindFile returns the header and ReadCloser for the entry in the tarfile that matches the filename. If nothing matches, an errors.NotFound error is returned.

func TarFiles

func TarFiles(fileList []string, target io.Writer, strip string) (shaSum string, err error)

TarFiles writes a tar stream into target holding the files listed in fileList. strip will be removed from the beginning of all the paths when stored (much like gnu tar -C option) Returns a Sha sum of the tar and nil if everything went well or empty sting and error in case of error. We use a base64 encoded sha1 hash, because this is the hash used by RFC 3230 Digest headers in http responses It is not safe to mutate files passed during this function, however at least the bytes up to the inital size are written successfully if no error is returned.

func UntarFiles

func UntarFiles(tarFile io.Reader, outputFolder string) error

UntarFiles will extract the contents of tarFile using outputFolder as root

Types

This section is empty.

Jump to

Keyboard shortcuts

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