archive

package
v0.0.0-...-e7d2f50 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// CompressNone is a null compression format.
	CompressNone
	// CompressBzip2 is a Bzip2 compression format.
	CompressBzip2
	// CompressGzip is a Gzip compression format.
	CompressGzip
	// CompressXZ is a XZ compression format.
	CompressXZ
)

Variables

View Source
var (
	// ErrUnsupportedCompress is an unsupported compression format error.
	ErrUnsupportedCompress = errors.New("unsupported compression")
)

Functions

This section is empty.

Types

type Header struct {
	Name     string
	LinkName string
	Size     int64
	Mode     os.FileMode
	User     string
	Group    string
	ModTime  time.Time
}

Header is an archive file header.

func (*Header) FileInfo

func (h *Header) FileInfo() os.FileInfo

FileInfo returns an os.FileInfo for the archive header.

func (*Header) TarHeader

func (h *Header) TarHeader() *tar.Header

TarHeader returns an tar.Header for the archive header.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader is an archive reader.

func NewReader

func NewReader(r io.Reader, compress int) (*Reader, error)

NewReader creates a new archive reader instance given an io.Reader and a compression format.

func (*Reader) Close

func (r *Reader) Close() error

Close closes the archive reader.

func (*Reader) Next

func (r *Reader) Next() (*Header, error)

Next advances to the next entry in the archive (see archive/tar Reader.Next for details).

func (*Reader) Read

func (r *Reader) Read(b []byte) (int, error)

Read reads from the current file in the archive (see archive/tar Reader.Read for details).

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is an archive writer.

func NewWriter

func NewWriter(w io.Writer, compress int) (*Writer, error)

NewWriter creates a new archive writer instance given an io.Writer and a compression format.

func (*Writer) Close

func (w *Writer) Close() error

Close closes the archive writer.

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

Write writes a file in the archive.

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(h *Header) error

WriteHeader writes a given file header to the archive.

type WriterBuffer

type WriterBuffer struct {
	*Writer
	// contains filtered or unexported fields
}

WriterBuffer is an archive writer buffer.

func NewWriterBuffer

func NewWriterBuffer(compress int) (*WriterBuffer, error)

NewWriterBuffer creates a new archive writer buffer instance given a compression format.

func (*WriterBuffer) Bytes

func (w *WriterBuffer) Bytes() []byte

Bytes returns the unread content of the archive writer buffer.

Jump to

Keyboard shortcuts

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