tar

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Package tar contains a tar file based file system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReaderFS

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

ReaderFS is a tar-based file system, reading files and metadata from a tar archive's io.Reader.

A ReaderFS is ready to use immediately after returning from the non-blocking constructor NewReaderFS(). This means the files are concurrently unpacked and accessible. If a file has not yet been unpacked, that file's operation will block until it is unpacked. If a directory's dir entries are accessed, that operation will block until the entire archive has been unpacked. (Tar ordering can't be guaranteed.)

func NewReaderFS

func NewReaderFS(ctx context.Context, r io.Reader, options ReaderFSOptions) (_ *ReaderFS, retErr error)

NewReaderFS returns a new ReaderFS from the given tar archive reader and options. Attempts to close the reader once the tar has completely unpacked.

If using a gzipped tar, be sure to pass the tar reader and not the original gzip reader.

func (*ReaderFS) Done

func (fs *ReaderFS) Done() <-chan struct{}

Done returns a channel that's closed when either the tar has been completely unpacked or the unarchive fails. The channel may close some time after the initial context is closed.

func (*ReaderFS) Open

func (fs *ReaderFS) Open(name string) (hackpadfs.File, error)

Open implements hackpadfs.FS

func (*ReaderFS) UnarchiveErr

func (fs *ReaderFS) UnarchiveErr() error

UnarchiveErr returns the error, if any, that occurred during unpacking. Behavior is undefined if Done() has not completed.

type ReaderFSOptions

type ReaderFSOptions struct {
	// UnarchiveFS is the destination FS to unarchive the reader into. Defaults to mem.FS.
	UnarchiveFS baseFS
}

ReaderFSOptions provides configuration options for a new ReaderFS.

Jump to

Keyboard shortcuts

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