tarball

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 18 Imported by: 0

README

Package tarball v1.1.1

Godoc Documentation

Purpose

This package contains helper to manipulate tarball, compressed or not.

tarball.Create(context.Context, string, io.Writer, CreateOpts) error
tarball.Extract(context.Context, string, io.Reader, ExtractOpts)
tarball.Tar(io.Writer, map[string]TarFileReader) error

Documentation

Index

Constants

View Source
const (

	// Types
	TypeReg           = '0'    // regular file
	TypeRegA          = '\x00' // regular file
	TypeLink          = '1'    // hard link
	TypeSymlink       = '2'    // symbolic link
	TypeChar          = '3'    // character device node
	TypeBlock         = '4'    // block device node
	TypeDir           = '5'    // directory
	TypeFifo          = '6'    // fifo node
	TypeCont          = '7'    // reserved
	TypeXHeader       = 'x'    // extended header
	TypeXGlobalHeader = 'g'    // global extended header
	TypeGNULongName   = 'L'    // Next file has a long name
	TypeGNULongLink   = 'K'    // Next file symlinks to a file w/ a long name
	TypeGNUSparse     = 'S'    // sparse file
)

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, src string, dst io.Writer, opts CreateOpts) error

func Extract

func Extract(ctx context.Context, dst string, reader io.Reader, opts *ExtractOpts) error

func FileInfoHeader

func FileInfoHeader(fi os.FileInfo, link string, fullpath string) (*tar.Header, error)

func Tar

func Tar(writer io.Writer, files map[string]TarFileReader) error

Tar is a methods to write a tarball out of a map of TarFileReader, data can then come from disk or memory.

Types

type CreateOpts

type CreateOpts struct {
	Fs          fspkg.Fs
	IncludeRoot bool

	// CopyBufferSize is the size of the memory buffer used to perform the copy
	// from the file to the tarball writer
	CopyBufferSize int64
}

CreateOpts gathers all possible options to create a tarball archive

type ExtractOpts

type ExtractOpts struct {
	Fs             fspkg.Fs
	User           string
	UID            int
	GID            int
	CopyBufferSize int64
}

type TarFileReader

type TarFileReader struct {
	Size int64
	io.Reader
}

Jump to

Keyboard shortcuts

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