tarutil

package
v0.0.0-...-fe628ba Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TarZipFile

func TarZipFile(tw *tar.Writer, p string, dir string) error

TarZipFile puts all files from a zip file into a tar stream.

Types

type Meta

type Meta struct {
	Mode    int64
	UserID  int
	GroupID int
}

Meta contains metadata of file

func ModeMeta

func ModeMeta(mode int64) *Meta

ModeMeta creates a Meta with specific mode.

type Stream

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

Stream is a tar stream of files (or zip files). Files are transfered in the order of adding.

func NewStream

func NewStream() *Stream

NewStream create a new tar stream.

func (*Stream) AddBytes

func (s *Stream) AddBytes(name string, m *Meta, bs []byte)

AddBytes adds a file of name into the stream, which content is bs.

func (*Stream) AddFile

func (s *Stream) AddFile(name string, m *Meta, f string)

AddFile adds a file of name and mode into the stream, which content is read from file f.

func (*Stream) AddString

func (s *Stream) AddString(name string, m *Meta, str string)

AddString adds a file of name into the stream, which content is str.

func (*Stream) AddZipFile

func (s *Stream) AddZipFile(name, f string)

AddZipFile adds a zip file into the stream.

func (*Stream) WriteTo

func (s *Stream) WriteTo(w io.Writer) (int64, error)

WriteTo writes the entire stream out to w.

Jump to

Keyboard shortcuts

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