tario

package module
v0.0.0-...-96c75a1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2016 License: MIT Imports: 7 Imported by: 1

README

tario

godoc build reads and writes to/from tar io.Reader, io.Writer, io.WriteAt turn into data stream

golang library for reading tar files/streams offsets as if they were just the file at that offsets also does some minimal validation of the tar header at the offset

Documentation

Index

Constants

View Source
const TARHEADERSIZE = 512

TARHEADERSIZE is size of a tar header in bytes

Variables

This section is empty.

Functions

func Validate

func Validate(r io.Reader) (*tar.Header, error)

Validate gets and validates the next header within the tarfile

Types

type TarReader

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

TarReader is an io.Reader on a tar file returning the file contained at that position of the tarfile

func NewReader

func NewReader(r io.Reader) *TarReader

NewReader takes an io.Reader and returns a TarReader the io.Reader should be position at the begining of the tar header for the file

func (*TarReader) Read

func (t *TarReader) Read(b []byte) (int, error)

Read satisfies the io.Reader interface for a TarReader

type TarWriter

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

TarWriter is an io.WriterAt being given a tar file and writing out the resulting file contained at that position of the tarfile

func NewFileWriter

func NewFileWriter() *TarWriter

func NewWriter

func NewWriter(wa io.WriterAt) *TarWriter

NewWriter takes an io.WriterAt and returns a TarWriter

func (*TarWriter) Close

func (t *TarWriter) Close() error

func (*TarWriter) Write

func (t *TarWriter) Write(p []byte) (n int, err error)

func (*TarWriter) WriteAt

func (t *TarWriter) WriteAt(p []byte, off int64) (n int, err error)

WriteAt satisfies the io.WriterAt interface for a TarWriter we assume that the write at offset 0 will include the entire tar header and that no other offset write overlaps the header

Jump to

Keyboard shortcuts

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