Documentation ¶
Index ¶
- type File
- func (f *File) Close() error
- func (f *File) Lock() error
- func (f *File) Name() string
- func (f *File) Read(p []byte) (n int, err error)
- func (f *File) ReadAt(p []byte, off int64) (n int, err error)
- func (f *File) Seek(offset int64, whence int) (int64, error)
- func (f *File) Truncate(size int64) error
- func (f *File) Unlock() error
- func (f *File) Write(p []byte) (n int, err error)
- func (f *File) WriteAt(p []byte, off int64) (n int, err error)
- type Filesystem
- func (f *Filesystem) Capabilities() billy.Capability
- func (f *Filesystem) Chmod(name string, mode os.FileMode) error
- func (f *Filesystem) Chown(name string, uid, gid int) error
- func (f *Filesystem) Chroot(path string) (billy.Filesystem, error)
- func (f *Filesystem) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (f *Filesystem) Create(filename string) (billy.File, error)
- func (f *Filesystem) Join(elem ...string) string
- func (f *Filesystem) Lchown(name string, uid, gid int) error
- func (f *Filesystem) Lstat(filename string) (os.FileInfo, error)
- func (f *Filesystem) MkdirAll(filename string, perm os.FileMode) error
- func (f *Filesystem) Open(filename string) (billy.File, error)
- func (f *Filesystem) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)
- func (f *Filesystem) ReadDir(path string) ([]os.FileInfo, error)
- func (f *Filesystem) Readlink(link string) (string, error)
- func (f *Filesystem) Remove(filename string) error
- func (f *Filesystem) Rename(oldpath, newpath string) error
- func (f *Filesystem) Root() string
- func (f *Filesystem) Stat(filename string) (os.FileInfo, error)
- func (f *Filesystem) Symlink(target, link string) error
- func (f *Filesystem) TempFile(dir string, prefix string) (billy.File, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File implements the billy.File interface by using the absfs.File interface.
type Filesystem ¶
type Filesystem struct {
// contains filtered or unexported fields
}
Filesystem implements all functions of the go-billy Filesystem interface by using the absfs.FileSystem interface.
func NewFS ¶
func NewFS(fs absfs.SymlinkFileSystem, dir string) (*Filesystem, error)
NewFS wraps a absfs.FileSystem go-billy from a `absfs.FileSystem` compatible object and a path. The path must be an absolute path and must already exist in the fs provided otherwise an error is returned.
func (*Filesystem) Capabilities ¶
func (f *Filesystem) Capabilities() billy.Capability
Capabilities returns the features supported by a filesystem. Absfs supports all capabilities.
func (*Filesystem) Chmod ¶
func (f *Filesystem) Chmod(name string, mode os.FileMode) error
Chmod changes the mode of the named file to mode. If the file is a symbolic link, it changes the mode of the link's target.
func (*Filesystem) Chown ¶
func (f *Filesystem) Chown(name string, uid, gid int) error
Chown changes the numeric uid and gid of the named file. If the file is a symbolic link, it changes the uid and gid of the link's target.
func (*Filesystem) Chroot ¶
func (f *Filesystem) Chroot(path 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 (*Filesystem) Chtimes ¶
Chtimes changes the access and modification times of the named file, similar to the Unix utime() or utimes() functions.
The underlying filesystem may truncate or round the values to a less precise time unit.
func (*Filesystem) Create ¶
func (f *Filesystem) 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 (*Filesystem) Join ¶
func (f *Filesystem) 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 (*Filesystem) Lchown ¶
func (f *Filesystem) Lchown(name string, uid, gid int) error
Lchown changes the numeric uid and gid of the named file. If the file is a symbolic link, it changes the uid and gid of the link itself.
func (*Filesystem) Lstat ¶
func (f *Filesystem) 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 (*Filesystem) MkdirAll ¶
func (f *Filesystem) MkdirAll(filename 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 (*Filesystem) Open ¶
func (f *Filesystem) 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 (*Filesystem) 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 (*Filesystem) ReadDir ¶
func (f *Filesystem) ReadDir(path string) ([]os.FileInfo, error)
ReadDir reads the directory named by dirname and returns a list of directory entries sorted by filename.
func (*Filesystem) Readlink ¶
func (f *Filesystem) Readlink(link string) (string, error)
Readlink returns the target path of link.
func (*Filesystem) Remove ¶
func (f *Filesystem) Remove(filename string) error
Remove removes the named file or directory.
func (*Filesystem) Rename ¶
func (f *Filesystem) Rename(oldpath, newpath 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 (*Filesystem) Root ¶
func (f *Filesystem) Root() string
Root returns the root path of the filesystem.
func (*Filesystem) Stat ¶
func (f *Filesystem) Stat(filename string) (os.FileInfo, error)
Stat returns a FileInfo describing the named file.
func (*Filesystem) Symlink ¶
func (f *Filesystem) 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 (*Filesystem) TempFile ¶
func (f *Filesystem) TempFile(dir string, 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.