struct@ FS
struct@ FS {
fn open(string) os.File
}Purpose
Method set of fs.FS / fs.File (constraints only; no interface values).
Required methods
openfn open(string) os.File- Operation on
FS: open resource or establish connection.
#io/fsDirectory-tree view. Implementation is concrete os.DirFS; package functions take &os.DirFS. valid_path checks unrooted slash paths.
struct@ FSstruct@ FS {
fn open(string) os.File
}Method set of fs.FS / fs.File (constraints only; no interface values).
open fn open(string) os.FileFS: open resource or establish connection.(FS) openfn open(string) os.FileOperation on FS: open resource or establish connection.
self SelfSelf instance used by this call (value receiver).string stringos.File — a value of this type
struct@ Filestruct@ File {
fn read(int) string
fn close() int
}Method-set constraint File.
read fn read(int) stringFile: read up to max bytes.close fn close() intFile: close the resource.(File) readfn read(int) stringOperation on File: read up to max bytes.
self SelfSelf instance used by this call (value receiver).int intstring — result string
(File) closefn close() intOperation on File: close the resource.
self SelfSelf instance used by this call (value receiver).int — a value of this type
struct DirEntrypub struct DirEntry {
pub name string
pub is_dir bool
}Structure encapsulating name, is_dir.
name stringis_dir boolvalid_pathpub fn valid_path(name &string) boolvalid_path is fs.ValidPath: unrooted slash-separated name; "." is the only allowed "." / empty / ".." exception (the FS root).
name &stringbool — true or false
read_filepub fn read_file(fsys &os.DirFS, name string) stringRead file. Throws on failure; handle the error or propagate it to the caller.
fsys &os.DirFSname stringstring — result string
read_dirpub fn read_dir(fsys &os.DirFS, name string) []DirEntryRead directory. Throws on failure; handle the error or propagate it to the caller.
fsys &os.DirFSname string[]DirEntry — slice result
statpub fn stat(fsys &os.DirFS, name string) FileInfoRead metadata. Throws on failure; handle the error or propagate it to the caller.
fsys &os.DirFSname stringFileInfo — a value of this type
subpub fn sub(fsys &os.DirFS, dir string) os.DirFSSubtract. Throws on failure; handle the error or propagate it to the caller.
fsys &os.DirFSdir stringos.DirFS — a value of this type