tarzst

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tarzst packs file trees into deterministic zstd compressed tars and serves them as read only file systems

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(files []File) ([]byte, error)

Tar of the files in path order with zero times and owners, compressed by a single threaded zstd encoder

func Extract

func Extract(archive []byte, dir string) error

Writes every archive file under dir with its permission bits, creating parent directories

func Manifest

func Manifest(files []File) string

Manifest text, one path, sha256 and octal mode line per file in path order

Types

type FS

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

FS serves an embedded archive like embed.FS, read only files and synthesized directories under an optional root

func NewFS

func NewFS(archive []byte, root string) *FS

File system over archive bytes decoded on first use, every path placed under root when root is set

func (*FS) Open

func (f *FS) Open(name string) (fs.File, error)

Opens a file for reading or a directory for listing

func (*FS) ReadDir

func (f *FS) ReadDir(name string) ([]fs.DirEntry, error)

Sorted entries of a directory

func (*FS) ReadFile

func (f *FS) ReadFile(name string) ([]byte, error)

Copy of a file's bytes

func (*FS) Stat

func (f *FS) Stat(name string) (fs.FileInfo, error)

File info of a path, modes as embed.FS reports them

type File

type File struct {
	Path string
	Data []byte
	Sum  string
	Mode fs.FileMode
}

One regular file of a tree with its slash path, bytes, digest and permission bits

func Collect

func Collect(root string, shebangExec bool) ([]File, error)

Every regular file under root in path order, refusing symlinks and other irregular entries

func Decode

func Decode(archive []byte) ([]File, error)

Regular files of an archive in path order, refusing entries that are not regular files or escape the tree

func NewFile

func NewFile(rel string, data []byte, mode fs.FileMode) File

File record over the given bytes, its digest computed

func ParseManifest

func ParseManifest(text string) ([]File, error)

Parses manifest text back into path ordered records without file bytes

Jump to

Keyboard shortcuts

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