utils

package
v0.0.0-...-8279aee Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GzipCT string = `application/x-gzip`
	TarCT  string = `application/octet-stream` //an assumption
	XzCT   string = "application/xz-compressed"
)

Variables

This section is empty.

Functions

func AddFile

func AddFile(tw *tar.Writer, pth, directory string) (err error)

func AddFileFromBuffer

func AddFileFromBuffer(tw *tar.Writer, file *os.File, fi os.FileInfo, directory string) (err error)

func AddTar

func AddTar(tw *tar.Writer, pth string) (err error)

func AddTarFromBuffer

func AddTarFromBuffer(tw *tar.Writer, tr *TarReader, rc io.ReadCloser) (err error)

func AddTarFromWriter

func AddTarFromWriter(tw *tar.Writer, tr *TarReader, rc io.ReadCloser) (err error)

func CreateNewOutput

func CreateNewOutput(path string) (file *os.File, err error)

func FileExistAndNotEmpty

func FileExistAndNotEmpty(file *os.File) bool

func GetCTFromFormat

func GetCTFromFormat(format string) string

func GetSeekedTar

func GetSeekedTar(input *os.File, output *os.File, seek int64) (out *os.File, err error)

func ReadContentType

func ReadContentType(file *os.File) (ct string, err error)

Types

type Crdr

type Crdr struct {
	io.Reader
	// contains filtered or unexported fields
}

func NewCrdr

func NewCrdr(fin *os.File, contentType string) (c *Crdr, err error)

func (*Crdr) Close

func (c *Crdr) Close() (err error)

type JobChannel

type JobChannel chan TarPart

type TarPart

type TarPart struct {
	Writer *tar.Writer
	Reader *TarReader
	Header *tar.Header
}

type TarReader

type TarReader struct {
	*tar.Reader
	Info fs.FileInfo
}

func GetReader

func GetReader(fin *os.File, format string) (tr *TarReader, rc io.ReadCloser, err error)

func OpenTarBuffer

func OpenTarBuffer(file *os.File, format string) (tr *TarReader, rc io.ReadCloser, err error)

func OpenTarFile

func OpenTarFile(pth string) (tr *TarReader, rc io.ReadCloser, err error)

Jump to

Keyboard shortcuts

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