filer

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Name  string
	IsDir bool
}

File represents a file in the virtual file system: every node is either a regular file or a directory. Symlinks are dereferenced in the implementations.

type Filer

type Filer interface {
	// ReadFile returns the contents of a file given it's path.
	ReadFile(path string) (content []byte, err error)
	// ReadDir lists a directory.
	ReadDir(path string) ([]File, error)
	// Close frees all the resources allocated by this Filer.
	Close()
	// PathsAreAlwaysSlash indicates whether the path separator is platform-independent ("/") or
	// OS-specific.
	PathsAreAlwaysSlash() bool
}

A Filer provides a list of files.

func FromDirectory

func FromDirectory(path string) (Filer, error)

FromDirectory returns a Filer that allows accessing over all the files contained in a directory.

func FromGitURL

func FromGitURL(url string) (Filer, error)

FromGitURL returns a Filer that allows accessing all the files in a Git repository given its URL.

func FromSiva

func FromSiva(path string) (Filer, error)

FromSiva returns a Filer that allows accessing all the files in a Git repository contained in a Siva file. See https://github.com/src-d/go-siva and https://github.com/src-d/go-billy-siva

func FromZIP

func FromZIP(path string) (Filer, error)

FromZIP returns a Filer that allows accessing all the files in a ZIP archive given its path.

func NestFiler

func NestFiler(filer Filer, prefix string) Filer

NestFiler wraps an existing Filer. It prepends the specified prefix to every path.

Jump to

Keyboard shortcuts

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