decoder

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package decoder reads pxar archives.

Package decoder reads pxar archives sequentially.

Decoder provides a streaming iterator (Next) over pxar archive entries. It handles both v1 and v2 formats, including FORMAT_VERSION headers and PRELUDE data.

Usage

dec := decoder.NewDecoder(reader, nil)
for {
    entry, err := dec.Next()
    if err == io.EOF {
        break
    }
    if err != nil {
        log.Fatal(err)
    }
    // process entry
}

For files that carry content, Contents returns an io.Reader to stream the payload. The reader is valid until the next call to Next.

For v2 split archives, provide a payload reader as the second argument to NewDecoder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

Decoder reads pxar archives sequentially.

func NewDecoder

func NewDecoder(input io.Reader, payloadReader io.Reader) *Decoder

NewDecoder creates a new pxar decoder.

func (*Decoder) Contents

func (d *Decoder) Contents() io.Reader

Contents returns a reader for the current file's content.

func (*Decoder) Next

func (d *Decoder) Next() (*pxar.Entry, error)

Next returns the next entry, or io.EOF when done.

Jump to

Keyboard shortcuts

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