tarfs

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 14 Imported by: 0

README

tarfs

Go package bridging between tarballs and fs.FS file systems

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoop = errors.New("tarfs: loop detected while following symbolic links")
)

Functions

func Archive

func Archive(tarball *tar.Writer, fsys fs.FS) error

Archive archives a file system into a tarball.

If the file system contains symbolic links, it must implement a ReadLink method with this signature to allow reading the value of the link targets:

type ReadLinkFS interface {
	ReadLink(name string) (string, error)
}

See https://github.com/golang/go/issues/49580 for details about the expected behavior of the ReadLinkFS interface.

func Extract

func Extract(path string, tarball *tar.Reader) error

Extract extracts files from the tarbal to a directory at path on the file system.

Note: at this time, since fs.FS is a read-only API, we chose to only support extracting files to a local path. This could be revisited in the future if Go gets an API to interact with writable file systems, likely we would then add a ExtractFS function to maintain backward compatiblity.

func OpenFS

func OpenFS(data io.ReaderAt, size int64) (fs.FS, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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