tarfs

package module
Version: v0.0.0-...-51be204 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

README

TarFS

Build Status codecov GoDoc Go Report Card

A wrapper around tar.Reader.

  • Implements the FileSystem interface for tar files.
  • Adds an Open method, that enables reading of file according to its' path.

Get

go get -u github.com/posener/tarfs

Example

See the example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	*tar.Reader
	// contains filtered or unexported fields
}

File is a struct that represent a Reader of a tar file it is created by the NewFile function.

func NewFile

func NewFile(path string) (*File, error)

NewFile returns a new File object, given a path to a tar file.

func (*File) Close

func (f *File) Close() error

Close closes the file

func (*File) Open

func (f *File) Open(path string) error

Open opens a file inside the tar reader. If the returned error is a nil, the next Read call will read the requested file inside the tar file.

type FileSystem

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

FileSystem is a struct that describes a tar filesystem. It should be created with the NewFile function.

func NewFS

func NewFS(path string) (*FileSystem, error)

NewFS returns a new tar FileSystem object from path to a tar archive. The returned object implements the FileSystem interface in https://godoc.org/github.com/kr/fs#FileSystem. It can be used by the fs.WalkFS function. It also enables reading of a specific fakeFile.

func (*FileSystem) Join

func (f *FileSystem) Join(elem ...string) string

Join implements the FileSystem Join method,

func (*FileSystem) Lstat

func (f *FileSystem) Lstat(name string) (os.FileInfo, error)

Lstat implements the FileSystem Lstat method, it returns fileinfo for a given path

func (*FileSystem) ReadDir

func (f *FileSystem) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir implements the FileSystem ReadDir method, It returns a list of fileinfos in a given path

Jump to

Keyboard shortcuts

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