filer

package
v4.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

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 FromGit

func FromGit(repo *git.Repository, headRef plumbing.ReferenceName) (Filer, error)

FromGit returns a Filer that allows accessing all the files in a Git repository

func FromGitURL

func FromGitURL(url string) (Filer, error)

FromGitURL returns a Filer that allows to access all the files in a Git repository's default branch given its URL. It keeps a shallow single-branch clone of the repository in memory.

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