tarfs

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Archive

func Archive(tarball *tar.Writer, path string) error

Archive archives the content of the directory at path into a tarball.

Types

type FileSystem

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

FileSystem is an implementation of the sandbox.FileSystem interface backed by a tarball.

func Open

func Open(data io.ReaderAt, size int64) (*FileSystem, error)

Open creates a file system from the tarball represented by the given section.

The file system retains the io.ReaderAt as a backing storage layer, it does not load the content of the files present in the tarball in memory; only the structure of the file system is held in memory (e.g. directory paths and metadata about the files).

func OpenFile

func OpenFile(f *os.File) (*FileSystem, error)

OpenFile is like Open but it takes an *os.File opened on a tarball as argument.

The file must remain open for as long as the program needs to access the file system.

func (*FileSystem) Filesize

func (fsys *FileSystem) Filesize() int64

Filesize returns the size occupied by the file data in the file system.

func (*FileSystem) Memsize

func (fsys *FileSystem) Memsize() int64

Memsize returns the size occupied by the file system in memory.

func (*FileSystem) Open

func (fsys *FileSystem) Open(name string, flags sandbox.OpenFlags, mode fs.FileMode) (sandbox.File, error)

Open satisfies sandbox.FileSystem.

func (*FileSystem) Size

func (fsys *FileSystem) Size() int64

Size returns the size of data in the file system, which is the value passed to Open when fsys was created. It is the full size of the underlying tarball.

Jump to

Keyboard shortcuts

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