tarfile

package
v0.0.0-...-2337eca Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

High level package around reading and writing tar archives. A tarfile can either be written to or read from, not both.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileReadWriter

type FileReadWriter interface {
	FileReader
	FileWriter
}

Interface for reading and writing tarfiles.

type FileReader

type FileReader interface {
	ReadFile(w io.Writer) (info os.FileInfo, err error)
}

Interface for reading tarfiles.

type FileWriter

type FileWriter interface {
	WriteFile(info os.FileInfo, r io.Reader) (n int, err error)
}

Interface for writing tarfiles.

type MetadataStore

type MetadataStore interface {
	WriteMetadata(name string, data []byte) (n int, err error)
	ReadMetadata() (md *metadataRecord, err error)
}

Interface for storing archive metadata.

type TarFile

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

High level structure for handling tarfiles.

func New

func New(w io.Writer) *TarFile

Create a new tar file for writing.

func Open

func Open(r io.Reader) *TarFile

Open a tar file for reading

func (*TarFile) Close

func (tf *TarFile) Close() error

Close tarfile, flushes content to underlying writer.

func (*TarFile) Flush

func (tf *TarFile) Flush() error

Finish writin current file data.

func (*TarFile) ReadFile

func (tf *TarFile) ReadFile(w io.Writer) (info os.FileInfo, err error)

Read content of next archive file into specified writer.

func (*TarFile) ReadMetadata

func (tf *TarFile) ReadMetadata() (md *metadataRecord, err error)

Read metadata from the tarfile.

func (*TarFile) Size

func (tf *TarFile) Size() int64

Get the current size of the underlying writer.

func (*TarFile) WriteFile

func (tf *TarFile) WriteFile(info os.FileInfo, r io.Reader) (n int, err error)

Write content of reader to tarfile.

func (*TarFile) WriteMetadata

func (tf *TarFile) WriteMetadata(name string, data []byte) (n int, err error)

Write metadata to the tarfile.

Jump to

Keyboard shortcuts

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