Versions in this module Expand all Collapse all v0 v0.1.1 Jun 3, 2026 Changes in this version + const DefaultMaxCompressSize + const DefaultMinCompressSize + const DefaultWriteBuffer + const FileExtension + var ErrClosed = errors.New("reader or resource already closed") + var ErrDuplicateEntryPath = errors.New("duplicate entry path") + var ErrEmptyInputs = errors.New("no inputs provided for pack") + var ErrEntryNotFound = errors.New("entry not found") + var ErrExtractPathOutsideRoot = errors.New("extract path escapes destination root") + var ErrInvalidChunk = errors.New("invalid PAK chunk") + var ErrInvalidCompressPattern = errors.New("invalid compress rules") + var ErrInvalidEntryOffset = errors.New("invalid entry offset") + var ErrInvalidEntryPath = errors.New("invalid entry path") + var ErrInvalidExtractPath = errors.New("invalid extract path") + var ErrInvalidHeader = errors.New("invalid PAK file: missing or bad FORM/PAC1 header") + var ErrMissingDataChunk = errors.New("missing DATA chunk") + var ErrMissingFileChunk = errors.New("missing FILE chunk") + var ErrNilReader = errors.New("reader is nil") + var ErrNilWriter = errors.New("writer is nil") + var ErrReaderAtRequired = errors.New("readerAt is required") + var ErrSizeOverflow = errors.New("size exceeds PAK format limits") + var ErrUnsupportedCompression = errors.New("unsupported compression type") + func NormalizePath(raw string) string + func ReadHead(path string) ([]byte, error) + func ReadHeadFromReaderAt(ra io.ReaderAt, size int64) ([]byte, error) + func ResolveSeriesPaths(basePath string) ([]string, error) + type ChunkInfo struct + Length uint32 + Offset int64 + Type string + type CompressionType uint32 + const CompressionNone + const CompressionZlib + type EditOptions struct + BackupKeep int + PackOptions PackOptions + type Editor struct + func OpenEditor(path string, opts EditOptions) (*Editor, error) + func (e *Editor) Add(inputs ...Input) error + func (e *Editor) Commit(ctx context.Context) (*PackResult, error) + func (e *Editor) Delete(paths ...string) error + func (e *Editor) DeleteDir(prefixes ...string) error + func (e *Editor) Replace(inputs ...Input) error + type EntryInfo struct + CompressedSize uint32 + CompressionType CompressionType + ModTime time.Time + Offset uint32 + OriginalSize uint32 + Path string + Unknown1 [4]byte + func ListEntries(path string) ([]EntryInfo, error) + func ListEntriesFromReaderAt(ra io.ReaderAt, size int64) ([]EntryInfo, error) + func ListEntriesFromReaderAtWithOptions(ra io.ReaderAt, size int64, opts ReaderOptions) ([]EntryInfo, error) + func ListEntriesWithOptions(path string, opts ReaderOptions) ([]EntryInfo, error) + func (e EntryInfo) IsCompressed() bool + func (e EntryInfo) LogicalSize() uint32 + type EntrySourceInfo struct + ArchivePath string + Entry EntryInfo + func ListEntriesSet(paths []string) ([]EntrySourceInfo, error) + func ListEntriesSetWithOptions(paths []string, opts ReaderOptions) ([]EntrySourceInfo, error) + func ListSeriesEntries(basePath string) ([]EntrySourceInfo, error) + func ListSeriesEntriesWithOptions(basePath string, opts ReaderOptions) ([]EntrySourceInfo, error) + type ExtractOptions struct + Entries []EntryInfo + MaxWorkers int + OnEntryDone func(entry EntryInfo, written int64, outputPath string) + RawNames bool + RawPayload bool + type Input struct + ModTime time.Time + Open func() (io.ReadCloser, error) + Path string + SizeHint int64 + type PackEntryProgress struct + Compressed bool + CompressedSize uint32 + CompressionCandidate bool + CompressionType CompressionType + Offset uint32 + OriginalSize uint32 + Path string + type PackOptions struct + Compress []pathrules.Rule + CompressMatcherOptions pathrules.MatcherOptions + Head []byte + MaxCompressSize uint32 + MinCompressSize uint32 + OnEntryDone func(entry PackEntryProgress) + WriterBufferSize int + type PackResult struct + CompressedBytes int64 + CompressedEntries int + DataSize int64 + Duration time.Duration + FileIndexSize int64 + RawBytes int64 + SkippedCompressionEntries int + WrittenEntries int + func Pack(ctx context.Context, out io.WriteSeeker, inputs []Input, opts PackOptions) (*PackResult, error) + func PackFile(ctx context.Context, outPath string, inputs []Input, opts PackOptions) (*PackResult, error) + type Reader struct + func NewReaderFromReaderAt(ra io.ReaderAt, size int64) (*Reader, error) + func NewReaderFromReaderAtWithOptions(ra io.ReaderAt, size int64, opts ReaderOptions) (*Reader, error) + func Open(path string) (*Reader, error) + func OpenWithOptions(path string, opts ReaderOptions) (*Reader, error) + func (r *Reader) Chunks() []ChunkInfo + func (r *Reader) Close() error + func (r *Reader) Entries() []EntryInfo + func (r *Reader) EntryAt(index int) (EntryInfo, bool) + func (r *Reader) EntryCount() int + func (r *Reader) Extract(ctx context.Context, dstDir string, opts ExtractOptions) error + func (r *Reader) ForEachEntry(callback func(entry EntryInfo) bool) + func (r *Reader) Head() []byte + func (r *Reader) OpenEntry(name string) (io.ReadCloser, error) + func (r *Reader) OpenEntryInfo(info EntryInfo) (io.ReadCloser, error) + func (r *Reader) OpenRawEntry(name string) (io.ReadCloser, error) + func (r *Reader) OpenRawEntryInfo(info EntryInfo) (io.ReadCloser, error) + func (r *Reader) ReadEntry(name string) ([]byte, error) + func (r *Reader) ReadRawEntry(name string) ([]byte, error) + type ReaderOptions struct + EntryPathPrefix string + MinEntryOriginalSize uint32 + RawOnUnknownCompression bool