Documentation ¶
Overview ¶
Package rwfs implements a read-write filesystem, extending fs.FS
Index ¶
- Constants
- func Copy(srcFS fs.FS, srcName string, destFS RWFS, destName string) error
- func CopyRecursive(srcFS fs.FS, srcName string, destFS RWFS, destName string) error
- func MkdirAll(rwfs RWFS, name string, perm fs.FileMode) error
- func ReadFile(rfs fs.FS, name string) ([]byte, error)
- func Stat(rfs fs.FS, name string) (fs.FileInfo, error)
- func WriteFile(wfs WriteFS, name string, data []byte, perm fs.FileMode) error
- type DirEntry
- type FileInfo
- type MemChild
- type MemDir
- type MemDirFP
- type MemFS
- func (o *MemFS) Create(name string) (WFile, error)
- func (o *MemFS) Mkdir(name string, perm fs.FileMode) error
- func (o *MemFS) Open(name string) (fs.File, error)
- func (o *MemFS) OpenFile(name string, flags int, perm fs.FileMode) (RWFile, error)
- func (o *MemFS) Remove(name string) error
- func (o *MemFS) Rename(oldName, newName string) error
- func (o *MemFS) Stat(name string) (fs.FileInfo, error)
- func (o *MemFS) Sub(name string) (*MemFS, error)
- type MemFile
- type MemFileFP
- type OSFS
- func (o *OSFS) Chmod(name string, mode fs.FileMode) error
- func (o *OSFS) Chown(name string, uid, gid int) error
- func (o *OSFS) Create(name string) (WFile, error)
- func (o *OSFS) CreateTemp(dir, pattern string) (RWFile, error)
- func (o *OSFS) Mkdir(name string, perm fs.FileMode) error
- func (o *OSFS) Open(name string) (fs.File, error)
- func (o *OSFS) OpenFile(name string, flag int, perm fs.FileMode) (RWFile, error)
- func (o *OSFS) Remove(name string) error
- func (o *OSFS) Rename(oldName, newName string) error
- func (o *OSFS) Stat(name string) (fs.FileInfo, error)
- func (o *OSFS) Sub(name string) (*OSFS, error)
- type OSFile
- type ROFS
- type ROFile
- type ROOpts
- type RWFS
- type RWFile
- type RWPerms
- type WFile
- type WriteFS
Constants ¶
View Source
const ( // exactly one of these must be used O_RDONLY = os.O_RDONLY // read-only O_WRONLY = os.O_WRONLY // write-only O_RDWR = os.O_RDWR // read-write // remaining values may be or'ed O_APPEND = os.O_APPEND // append when writing O_CREATE = os.O_CREATE // create if missing O_EXCL = os.O_EXCL // file must not exist, used with O_CREATE O_SYNC = os.O_SYNC // synchronous I/O O_TRUNC = os.O_TRUNC // truncate on open )
Variables ¶
This section is empty.
Functions ¶
func CopyRecursive ¶
CopyRecursive will recursively copy a directory tree to the destination
Types ¶
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
type MemFS ¶
type MemFS struct {
// contains filtered or unexported fields
}
type MemFileFP ¶
type MemFileFP struct {
// contains filtered or unexported fields
}
type OSFS ¶
type OSFS struct {
// contains filtered or unexported fields
}
func (*OSFS) CreateTemp ¶ added in v0.4.3
type WFile ¶
type WFile interface { // Close closes the open file Close() error // Stat returns the FileInfo of the file Stat() (fi fs.FileInfo, err error) // Write writes len(b) bytes to the file. // It returns the number of bytes written, and any error if n != len(b). Write(b []byte) (n int, err error) }
WFile is the interface for a writable file
type WriteFS ¶
type WriteFS interface { // Create creates a new file Create(string) (WFile, error) // Mkdir creates a directory Mkdir(string, fs.FileMode) error // OpenFile generalized file open with options for a flag and permissions OpenFile(string, int, fs.FileMode) (RWFile, error) // Remove removes the named file or (empty) directory. Remove(string) error // Rename moves a file or directory to a new name Rename(oldName, newName string) error }
WriteFS is an interface for a writable filesystem
Click to show internal directories.
Click to hide internal directories.