Documentation ¶
Index ¶
- Variables
- func Exists(fs FS, path string) bool
- func ReadAll(fs FS, path string) ([]byte, error)
- func ReadDir(fs FS, dirname string) ([]os.FileInfo, error)
- func WritePath(fs FS, path string, data []byte) error
- type FS
- type File
- type ReadOnlyFS
- func (r *ReadOnlyFS) Abs(name string) (string, error)
- func (r *ReadOnlyFS) Append(name string, data []byte) error
- func (r *ReadOnlyFS) AppendPath(name string, data []byte) error
- func (r *ReadOnlyFS) Chdir(name string) error
- func (r *ReadOnlyFS) Getwd() (string, error)
- func (r *ReadOnlyFS) Mkdir(name string) error
- func (r *ReadOnlyFS) MkdirAll(name string) error
- func (r *ReadOnlyFS) Open(name string) (File, error)
- func (r *ReadOnlyFS) OpenForAppend(name string) (File, error)
- func (r *ReadOnlyFS) OpenForWrite(name string) (File, error)
- func (r *ReadOnlyFS) OpenIfExists(name string) (File, error)
- func (r *ReadOnlyFS) RemoveAll(name string) error
- func (r *ReadOnlyFS) Rename(oldPath, newPath string) error
- func (r *ReadOnlyFS) SetHome(name string) error
- func (r *ReadOnlyFS) Stat(name string) (os.FileInfo, error)
- func (r *ReadOnlyFS) Write(name string, data []byte) error
- type RestrictedFS
- func (r *RestrictedFS) Abs(name string) (string, error)
- func (r *RestrictedFS) AddToBlacklist(name string) error
- func (r *RestrictedFS) AddToWhitelist(name string) error
- func (r *RestrictedFS) Append(name string, data []byte) error
- func (r *RestrictedFS) AppendPath(name string, data []byte) error
- func (r *RestrictedFS) Chdir(name string) error
- func (r *RestrictedFS) Getwd() (string, error)
- func (r *RestrictedFS) Mkdir(name string) error
- func (r *RestrictedFS) MkdirAll(name string) error
- func (r *RestrictedFS) Open(name string) (File, error)
- func (r *RestrictedFS) OpenForAppend(name string) (File, error)
- func (r *RestrictedFS) OpenForWrite(name string) (File, error)
- func (r *RestrictedFS) OpenIfExists(name string) (File, error)
- func (r *RestrictedFS) RemoveAll(name string) error
- func (r *RestrictedFS) Rename(oldPath, newPath string) error
- func (r *RestrictedFS) SetHome(name string) error
- func (r *RestrictedFS) Stat(name string) (os.FileInfo, error)
- func (r *RestrictedFS) Write(name string, data []byte) error
- type RootedFS
- func (r *RootedFS) Abs(name string) (string, error)
- func (r *RootedFS) Append(name string, data []byte) error
- func (r *RootedFS) AppendPath(name string, data []byte) error
- func (r *RootedFS) Chdir(name string) error
- func (r *RootedFS) Getwd() (string, error)
- func (r *RootedFS) Mkdir(name string) error
- func (r *RootedFS) MkdirAll(name string) error
- func (r *RootedFS) Open(name string) (File, error)
- func (r *RootedFS) OpenForAppend(name string) (File, error)
- func (r *RootedFS) OpenForWrite(name string) (File, error)
- func (r *RootedFS) OpenIfExists(name string) (File, error)
- func (r *RootedFS) RemoveAll(name string) error
- func (r *RootedFS) Rename(oldPath, newPath string) error
- func (r *RootedFS) SetHome(name string) error
- func (r *RootedFS) Stat(name string) (os.FileInfo, error)
- func (r *RootedFS) Write(name string, data []byte) error
- type VirtualFS
- func (v *VirtualFS) Abs(name string) (string, error)
- func (v *VirtualFS) Append(name string, data []byte) error
- func (v *VirtualFS) AppendPath(path string, data []byte) error
- func (v *VirtualFS) Chdir(name string) error
- func (v *VirtualFS) CopyAt(dst, src string, fs FS) error
- func (v *VirtualFS) Getwd() (string, error)
- func (v *VirtualFS) Mkdir(name string) error
- func (v *VirtualFS) MkdirAll(name string) error
- func (v *VirtualFS) Open(name string) (File, error)
- func (v *VirtualFS) OpenForAppend(name string) (File, error)
- func (v *VirtualFS) OpenForWrite(name string) (File, error)
- func (v *VirtualFS) OpenIfExists(name string) (File, error)
- func (v *VirtualFS) PrintPaths()
- func (v *VirtualFS) RemoveAll(name string) error
- func (v *VirtualFS) Rename(oldPath, newPath string) error
- func (v *VirtualFS) SetHome(name string) error
- func (v *VirtualFS) Stat(name string) (os.FileInfo, error)
- func (v *VirtualFS) Write(name string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrReadOnly = errors.New("this file is readonly")
View Source
var OS = &osFS{}
Functions ¶
Types ¶
type FS ¶
type FS interface { Open(name string) (File, error) OpenIfExists(name string) (File, error) OpenForWrite(name string) (File, error) OpenForAppend(name string) (File, error) Stat(name string) (os.FileInfo, error) Write(name string, data []byte) error Append(name string, data []byte) error AppendPath(name string, data []byte) error Rename(oldPath, newPath string) error RemoveAll(path string) error Mkdir(name string) error MkdirAll(name string) error Chdir(dir string) error Getwd() (string, error) Abs(name string) (string, error) SetHome(name string) error }
type ReadOnlyFS ¶
type ReadOnlyFS struct {
// contains filtered or unexported fields
}
ReadOnlyFS implements fileSystem that serves a directory as root
func NewReadOnlyFS ¶
func NewReadOnlyFS(fs FS) *ReadOnlyFS
func (*ReadOnlyFS) AppendPath ¶
func (r *ReadOnlyFS) AppendPath(name string, data []byte) error
func (*ReadOnlyFS) Chdir ¶
func (r *ReadOnlyFS) Chdir(name string) error
func (*ReadOnlyFS) Getwd ¶
func (r *ReadOnlyFS) Getwd() (string, error)
func (*ReadOnlyFS) Mkdir ¶
func (r *ReadOnlyFS) Mkdir(name string) error
func (*ReadOnlyFS) MkdirAll ¶
func (r *ReadOnlyFS) MkdirAll(name string) error
func (*ReadOnlyFS) OpenForAppend ¶
func (r *ReadOnlyFS) OpenForAppend(name string) (File, error)
func (*ReadOnlyFS) OpenForWrite ¶
func (r *ReadOnlyFS) OpenForWrite(name string) (File, error)
func (*ReadOnlyFS) OpenIfExists ¶
func (r *ReadOnlyFS) OpenIfExists(name string) (File, error)
func (*ReadOnlyFS) RemoveAll ¶
func (r *ReadOnlyFS) RemoveAll(name string) error
func (*ReadOnlyFS) Rename ¶
func (r *ReadOnlyFS) Rename(oldPath, newPath string) error
func (*ReadOnlyFS) SetHome ¶
func (r *ReadOnlyFS) SetHome(name string) error
Sets the home directory
type RestrictedFS ¶
type RestrictedFS struct {
// contains filtered or unexported fields
}
RestrictedFS implements fileSystem that serves a directory as root
func NewRestrictedFS ¶
func NewRestrictedFS(fs FS) (*RestrictedFS, error)
func (*RestrictedFS) AddToBlacklist ¶
func (r *RestrictedFS) AddToBlacklist(name string) error
func (*RestrictedFS) AddToWhitelist ¶
func (r *RestrictedFS) AddToWhitelist(name string) error
func (*RestrictedFS) AppendPath ¶
func (r *RestrictedFS) AppendPath(name string, data []byte) error
func (*RestrictedFS) Chdir ¶
func (r *RestrictedFS) Chdir(name string) error
func (*RestrictedFS) Getwd ¶
func (r *RestrictedFS) Getwd() (string, error)
func (*RestrictedFS) Mkdir ¶
func (r *RestrictedFS) Mkdir(name string) error
func (*RestrictedFS) MkdirAll ¶
func (r *RestrictedFS) MkdirAll(name string) error
func (*RestrictedFS) OpenForAppend ¶
func (r *RestrictedFS) OpenForAppend(name string) (File, error)
func (*RestrictedFS) OpenForWrite ¶
func (r *RestrictedFS) OpenForWrite(name string) (File, error)
func (*RestrictedFS) OpenIfExists ¶
func (r *RestrictedFS) OpenIfExists(name string) (File, error)
func (*RestrictedFS) RemoveAll ¶
func (r *RestrictedFS) RemoveAll(name string) error
func (*RestrictedFS) Rename ¶
func (r *RestrictedFS) Rename(oldPath, newPath string) error
func (*RestrictedFS) SetHome ¶
func (r *RestrictedFS) SetHome(name string) error
Sets the home directory
type RootedFS ¶
type RootedFS struct {
// contains filtered or unexported fields
}
RootedFS implements fileSystem that serves a directory as root
type VirtualFS ¶
type VirtualFS struct {
// contains filtered or unexported fields
}
A tree of virtual files. A virtual file can be a directory or a individual file.
func NewVirtualFS ¶
func NewVirtualFS() *VirtualFS
func (*VirtualFS) PrintPaths ¶
func (v *VirtualFS) PrintPaths()
Click to show internal directories.
Click to hide internal directories.