afero

package module
v0.0.0-...-e9d3de5 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

go-billy-afero

A wrapper of the afero api to satisfy the expected behavior and interface of go-billy.

Documentation

Overview

Package afero provides a billy filesystem that wraps the afero api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(fs afero.Fs, root string, debug bool) billy.Filesystem

New returns a new OS filesystem.

Types

type Afero

type Afero struct {
	Debug bool
	// contains filtered or unexported fields
}

Afero is a wrapper of the Afero API.

func (*Afero) Capabilities

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

Capabilities implements the Capable interface.

func (*Afero) Chroot

func (fs *Afero) Chroot(fPath 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 (*Afero) Create

func (fs *Afero) 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 (*Afero) Join

func (fs *Afero) 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 (*Afero) Lstat

func (fs *Afero) 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 (*Afero) MkdirAll

func (fs *Afero) 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 (*Afero) Open

func (fs *Afero) 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 (*Afero) OpenFile

func (fs *Afero) 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 (*Afero) ReadDir

func (fs *Afero) 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 *Afero) Readlink(link string) (string, error)

Readlink returns the target path of link.

func (*Afero) Remove

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

Remove removes the named file or directory.

func (*Afero) RemoveAll

func (fs *Afero) 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 (*Afero) Rename

func (fs *Afero) 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 (*Afero) Root

func (fs *Afero) Root() string

Root returns the root path of the filesystem.

func (*Afero) Stat

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

Stat returns a FileInfo describing the named file.

func (fs *Afero) 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 (*Afero) TempFile

func (fs *Afero) 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.

Jump to

Keyboard shortcuts

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