Documentation ¶
Overview ¶
Package afero provides a billy filesystem that wraps the afero api.
Index ¶
- func New(fs afero.Fs, root string, debug bool) billy.Filesystem
- type Afero
- func (fs *Afero) Capabilities() billy.Capability
- func (fs *Afero) Chroot(fPath string) (billy.Filesystem, error)
- func (fs *Afero) Create(filename string) (billy.File, error)
- func (fs *Afero) Join(elem ...string) string
- func (fs *Afero) Lstat(filename string) (os.FileInfo, error)
- func (fs *Afero) MkdirAll(path string, perm os.FileMode) error
- func (fs *Afero) Open(filename string) (billy.File, error)
- func (fs *Afero) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)
- func (fs *Afero) ReadDir(path string) ([]os.FileInfo, error)
- func (fs *Afero) Readlink(link string) (string, error)
- func (fs *Afero) Remove(filename string) error
- func (fs *Afero) RemoveAll(filePath string) error
- func (fs *Afero) Rename(from, to string) error
- func (fs *Afero) Root() string
- func (fs *Afero) Stat(filename string) (os.FileInfo, error)
- func (fs *Afero) Symlink(target, link string) error
- func (fs *Afero) TempFile(dir, prefix string) (billy.File, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
ReadDir reads the directory named by dirname and returns a list of directory entries sorted by filename.
func (*Afero) RemoveAll ¶
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 ¶
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) Symlink ¶
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 ¶
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.