archive

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArchiveMagic = "ARCHIVE0\n"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveReader

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

func NewArchiveReader

func NewArchiveReader(index io.Reader, indexCloser io.Closer, contents io.ReaderAt) (*ArchiveReader, error)

func (*ArchiveReader) Close

func (ar *ArchiveReader) Close() error

Close implements io.Closer.

func (*ArchiveReader) Hash

func (ar *ArchiveReader) Hash() []byte

Hash returns the SHA256 hash of the contents of the entry.

func (*ArchiveReader) Kind

func (ar *ArchiveReader) Kind() EntryKind

Kind returns the kind of the entry.

func (*ArchiveReader) Linkname

func (ar *ArchiveReader) Linkname() string

Linkname returns the linkname of the entry.

func (*ArchiveReader) ModTime

func (ar *ArchiveReader) ModTime() time.Time

ModTime returns the modification time of the entry.

func (*ArchiveReader) Mode

func (ar *ArchiveReader) Mode() fs.FileMode

Mode returns the mode of the entry.

func (*ArchiveReader) Name

func (ar *ArchiveReader) Name() string

Name returns the name of the entry.

func (*ArchiveReader) NextEntry

func (ar *ArchiveReader) NextEntry() error

NextEntry reads the next entry from the index.

func (*ArchiveReader) Open

func (ar *ArchiveReader) Open() (Handle, error)

Open returns a handle to the entry.

func (*ArchiveReader) Owner

func (ar *ArchiveReader) Owner() (uid, gid int)

Owner returns the uid and gid of the entry.

func (*ArchiveReader) Size

func (ar *ArchiveReader) Size() int64

Size returns the size of the entry in bytes.

type ArchiveWriter

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

func NewArchiveWriter

func NewArchiveWriter(index, contents io.Writer) (*ArchiveWriter, error)

func (*ArchiveWriter) DisablePadding

func (w *ArchiveWriter) DisablePadding()

func (*ArchiveWriter) WriteEntry

func (w *ArchiveWriter) WriteEntry(entry *EntryFactory, r io.Reader) error

type Entry

type Entry struct {
	Kind     EntryKind
	Name     string
	Linkname string
	Size     int64
	Mode     fs.FileMode
	UID      int
	GID      int
	ModTime  time.Time
	Hash     []byte
	// contains filtered or unexported fields
}

func ReadAllEntries

func ReadAllEntries(index io.Reader) ([]Entry, error)

func (*Entry) Open

func (e *Entry) Open(contents io.ReaderAt) (Handle, error)

type EntryFactory

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

func (*EntryFactory) Kind

func (e *EntryFactory) Kind(k EntryKind) *EntryFactory

func (*EntryFactory) Linkname

func (e *EntryFactory) Linkname(s string) *EntryFactory

func (*EntryFactory) ModTime

func (e *EntryFactory) ModTime(t time.Time) *EntryFactory

func (*EntryFactory) Mode

func (e *EntryFactory) Mode(s fs.FileMode) *EntryFactory

func (*EntryFactory) Name

func (e *EntryFactory) Name(s string) *EntryFactory

func (*EntryFactory) Owner

func (e *EntryFactory) Owner(uid, gid int) *EntryFactory

func (*EntryFactory) Size

func (e *EntryFactory) Size(s int64) *EntryFactory

type EntryKind

type EntryKind uint8
const (
	EntryKindInvalid   EntryKind = iota
	EntryKindRegular             // Regular file with contents
	EntryKindDirectory           // Directory
	EntryKindSymlink             // Symbolic link to another file
	EntryKindHardlink            // Hard link to another file
	EntryKindExtended            // Extended file with metadata
	EntryKindDeleted             // Deleted file
)

func (EntryKind) String

func (k EntryKind) String() string

type Handle

type Handle interface {
	io.Reader
	io.ReaderAt
}

Jump to

Keyboard shortcuts

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