tarutil

package
v2.8.0-nightly.20231107 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConcatFileContent

func ConcatFileContent(dst io.Writer, src io.Reader) error

ConcatFileContent writes the content of each file in the stream to dst, one after another. Headers are not copied. `src` must be a tar stream

This is not a terribly useful function but many of the tests are structured around the 1.x behavior of concatenating files, and so this is useful for porting those tests.

func Equal

func Equal(file1, file2 File, full ...bool) (bool, error)

func Export

func Export(storageRoot string, w io.Writer, opts ...ExportOption) (retErr error)

func Import

func Import(storageRoot string, r io.Reader, cb ...func(*tar.Header) error) error

func Iterate

func Iterate(r io.Reader, cb func(File) error, stream ...bool) error

func NewHeader

func NewHeader(name string, size int64) *tar.Header

func NewReader

func NewReader(files []File) (io.Reader, error)

Reader converts a set of files to a tar stream. TODO: Probably should just go to disk for this.

func WithWriter

func WithWriter(w io.Writer, cb func(*tar.Writer) error) (retErr error)

func WriteFile

func WriteFile(tw *tar.Writer, file File) error

Types

type ExportOption

type ExportOption func(*exportConfig)

ExportOption configures an export call.

func WithHeaderCallback

func WithHeaderCallback(cb func(*tar.Header) error) ExportOption

WithHeaderCallback configures the export call to execute the callback for each tar file exported.

type File

type File interface {
	Header() (*tar.Header, error)
	Content(io.Writer) error
}

func NewMemFile

func NewMemFile(name string, data []byte) File

func NewStreamFile

func NewStreamFile(name string, size int64, r io.Reader) File

Jump to

Keyboard shortcuts

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