Documentation
¶
Index ¶
- Variables
- func Lookup(fsys fs.FS, name string) (fs.FS, string, error)
- func Open(fsys fs.FS, name string) (fs.File, error)
- func ReadDir(fsys fs.FS, name string) ([]fs.DirEntry, error)
- func ReadFile(fsys fs.FS, name string) ([]byte, error)
- func ReadLink(fsys fs.FS, name string) (string, error)
- func RootFS(fsys fs.FS) fs.FS
- func Stat(fsys fs.FS, name string) (fs.FileInfo, error)
- func Sub(fsys fs.FS, name string) (fs.FS, error)
- func Walk(name string, fn func(path string) error) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrLoop is returned when attempting to resolve paths that have followed // too many symbolic links. ErrLoop = errors.New("loop") )
Functions ¶
func Lookup ¶
Lookup looks for the name if fsys, following symbolic link that are encountered along the path.
The function returns a view of fsys positioned on the last directory, and the base name of the file to look for in this directory. The name is guaranteed not to refer to a symbolic link.
The function guarantees that links never escape the file system root. If a link pointing above the root is encountered, it is rebased off of the root similarly to how "/.." resolves to "/" on posix systems. Lookup can therefore be used as a sandboxing mechanism to prevent escaping the bounds of a read-only file system; beware that if the underlying file system can be modified concurrently, these guarantees do no apply anymore!
func RootFS ¶
RooFS returns a fs.FS wrapping fsys and using the Lookup function when accesing files (e.g. calling Open, Stat, etc...).
Types ¶
This section is empty.