Documentation ¶
Overview ¶
Package fs provides types and methods for interacting with the filesystem, as an abstraction layer.
It provides an implementation that uses the operating system filesystem, and an interface that should be implemented if you want to provide your own filesystem.
Index ¶
- type File
- type Fs
- type OsFs
- func (OsFs) Create(name string) (File, error)
- func (OsFs) Mkdir(name string, perm os.FileMode) error
- func (OsFs) MkdirAll(path string, perm os.FileMode) error
- func (OsFs) Open(name string) (File, error)
- func (OsFs) OpenFile(name string, flag int, perm os.FileMode) (File, error)
- func (OsFs) Remove(name string) error
- func (OsFs) RemoveAll(path string) error
- func (OsFs) Rename(oldname, newname string) error
- func (OsFs) Stat(name string) (os.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File interface { io.Closer io.Reader io.ReaderAt io.Seeker io.Writer Name() string Fd() uintptr Stat() (os.FileInfo, error) WriteString(s string) (ret int, err error) Truncate(size int64) error }
File represents a file in the filesystem.
type Fs ¶
type Fs interface { // Create creates a file in the filesystem, returning the file and an // error, if any happens. Create(name string) (File, error) // Mkdir creates a directory in the filesystem, return an error if any // happens. Mkdir(name string, perm os.FileMode) error // MkdirAll creates a directory path and all parents that does not exist // yet. MkdirAll(path string, perm os.FileMode) error // Open opens a file, returning it or an error, if any happens. Open(name string) (File, error) // OpenFile opens a file using the given flags and the given mode. OpenFile(name string, flag int, perm os.FileMode) (File, error) // Remove removes a file identified by name, returning an error, if any // happens. Remove(name string) error // RemoveAll removes a directory path and all any children it contains. It // does not fail if the path does not exist (return nil). RemoveAll(path string) error // Rename renames a file. Rename(oldname, newname string) error // Stat returns a FileInfo describing the named file, or an error, if any // happens. Stat(name string) (os.FileInfo, error) }
Fs is the filesystem interface.
Any simulated or real filesystem should implement this interface.
type OsFs ¶
type OsFs struct{}
OsFs is a Fs implementation that uses functions provided by the os package.
For details in any method, check the documentation of the os package (http://golang.org/pkg/os/).
Click to show internal directories.
Click to hide internal directories.