Documentation ¶
Overview ¶
Package filesystem contains types and methods for interacting with the underlying file system.
Index ¶
- type FileInfo
- type FileReader
- type FileSystem
- func (fs *FileSystem) Clear() error
- func (fs *FileSystem) Copy(src, dest string) error
- func (fs *FileSystem) Delete(name string) error
- func (fs *FileSystem) List(name string) ([]*FileInfo, error)
- func (fs *FileSystem) Move(src, dest string) error
- func (fs *FileSystem) Reader(name string) (FileReader, error)
- func (fs *FileSystem) Stat(name string) (*FileInfo, error)
- func (fs *FileSystem) Walk(loc string, fn WalkFunc) error
- func (fs *FileSystem) Writer(name string) (FileWriter, error)
- type FileWriter
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileReader ¶
type FileReader interface { io.ReadCloser }
The FileReader interface describes files that can be read from
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
The FileSystem type contains methods for manipulating files on the host system.
func New ¶
func New(root string) *FileSystem
New creates a new FileSystem instance that works on the given root directory path.
func (*FileSystem) Copy ¶
func (fs *FileSystem) Copy(src, dest string) error
Copy a file from one location to another. Returns an error if a file already exists at the destination.
func (*FileSystem) Delete ¶
func (fs *FileSystem) Delete(name string) error
Delete a file from the system.
func (*FileSystem) List ¶
func (fs *FileSystem) List(name string) ([]*FileInfo, error)
List all files within a directory
func (*FileSystem) Move ¶
func (fs *FileSystem) Move(src, dest string) error
Move a file from one location to another.
func (*FileSystem) Reader ¶
func (fs *FileSystem) Reader(name string) (FileReader, error)
Reader opens a new reader for the given file.
func (*FileSystem) Stat ¶
func (fs *FileSystem) Stat(name string) (*FileInfo, error)
Stat returns info about a file from the filesystem. Returns an error if it does not exist.
func (*FileSystem) Walk ¶
func (fs *FileSystem) Walk(loc string, fn WalkFunc) error
Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links.
func (*FileSystem) Writer ¶
func (fs *FileSystem) Writer(name string) (FileWriter, error)
Writer creates a new writer for the given file, if it does not exist, the file will be created.
type FileWriter ¶
type FileWriter interface { io.WriteCloser io.WriterAt }
The FileWriter interface describes files that can be written to