afero2billy

package module
Version: v1.3.3-v5 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: MPL-2.0 Imports: 6 Imported by: 0

README

afero2billy

Adapts an Afero filesystem to a Billy filesystem.

Versioning

Git tags are created using Afero's version, a dash (-), and ending with Billy's version. Example: 1.3.3-v5

Documentation

Overview

Package afero2billy adapts an Afero filesystem to a billy filesystem

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(fs afero.Fs) billy.Filesystem

New returns a billy filesystem backed by an input afero filesystem.

Types

type Billy

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

Billy implements a go-billy filesystem backed by an Afero filesystem

func (*Billy) Capabilities

func (fs *Billy) Capabilities() billy.Capability

Capabilities implements the Capable interface.

func (*Billy) Chroot

func (fs *Billy) Chroot(basePath string) (billy.Filesystem, error)

Chroot returns a new filesystem from the same type where the new root is the given path. Files outside of the designated directory tree cannot be accessed.

func (*Billy) Create

func (fs *Billy) Create(filename string) (billy.File, error)

Create creates the named file with mode 0666 (before umask), truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR.

func (*Billy) Join

func (fs *Billy) Join(elem ...string) string

Join joins any number of path elements into a single path, adding a Separator if necessary. Join calls filepath.Clean on the result; in particular, all empty strings are ignored. On Windows, the result is a UNC path if and only if the first path element is a UNC path.

func (*Billy) Lstat

func (fs *Billy) Lstat(filename string) (os.FileInfo, error)

Lstat returns a FileInfo describing the named file. If the file is a symbolic link, the returned FileInfo describes the symbolic link. Lstat makes no attempt to follow the link.

func (*Billy) MkdirAll

func (fs *Billy) MkdirAll(path string, perm os.FileMode) error

MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. The permission bits perm are used for all directories that MkdirAll creates. If path is/ already a directory, MkdirAll does nothing and returns nil.

func (*Billy) Open

func (fs *Billy) Open(filename string) (billy.File, error)

Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY.

func (*Billy) OpenFile

func (fs *Billy) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)

OpenFile is the generalized open call; most users will use Open or Create instead. It opens the named file with specified flag (O_RDONLY etc.) and perm, (0666 etc.) if applicable. If successful, methods on the returned File can be used for I/O.

func (*Billy) ReadDir

func (fs *Billy) ReadDir(path string) ([]os.FileInfo, error)

ReadDir reads the directory named by dirname and returns a list of directory entries sorted by filename.

func (fs *Billy) Readlink(link string) (string, error)

Readlink returns the target path of link.

func (*Billy) Remove

func (fs *Billy) Remove(filename string) error

Remove removes the named file or directory.

func (*Billy) RemoveAll

func (fs *Billy) RemoveAll(filePath string) error

RemoveAll removes a directory path and any children it contains. It does not fail if the path does not exist (return nil).

func (*Billy) Rename

func (fs *Billy) Rename(from, to string) error

Rename renames (moves) oldpath to newpath. If newpath already exists and is not a directory, Rename replaces it. OS-specific restrictions may apply when oldpath and newpath are in different directories.

func (*Billy) Root

func (fs *Billy) Root() string

Root returns the root path of the filesystem.

func (*Billy) Stat

func (fs *Billy) Stat(filename string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file.

func (fs *Billy) Symlink(target, link string) error

Symlink creates a symbolic-link from link to target. target may be an absolute or relative path, and need not refer to an existing node. Parent directories of link are created as necessary.

func (*Billy) TempFile

func (fs *Billy) TempFile(dir, prefix string) (billy.File, error)

TempFile creates a new temporary file in the directory dir with a name beginning with prefix, opens the file for reading and writing, and returns the resulting *os.File. If dir is the empty string, TempFile uses the default directory for temporary files (see os.TempDir). Multiple programs calling TempFile simultaneously will not choose the same file. The caller can use f.Name() to find the pathname of the file. It is the caller's responsibility to remove the file when no longer needed.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL