Documentation
¶
Overview ¶
Package vfs is the file system a build reads from: the files a deck includes, its kinds and data files, slides.yaml or slides.hcl, and theme CSS.
The command reads the disk (OS). An editor reads its own buffers and the files it chose to hand over (Map), which keeps a deck that names /etc/passwd from reading it, and lets the same build run where there is no disk at all, in WebAssembly.
Names are the paths the build forms with path/filepath, relative to the working directory or absolute; they are not io/fs's slash-separated, unrooted names, since a deck says "../shared/kinds.yaml".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FS ¶
type FS interface {
// ReadFile returns a file's contents.
ReadFile(name string) ([]byte, error)
// Stat describes a file or a directory.
Stat(name string) (fs.FileInfo, error)
// ReadDir lists a directory, sorted by name.
ReadDir(name string) ([]fs.DirEntry, error)
}
FS reads files.
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a file system held in memory: file names to contents. A name that is not there reads as fs.ErrNotExist and is remembered, so that a caller that has the files elsewhere (an editor's workspace) can hand them over and build again.
Directories are implied by the files under them, and a directory can be declared empty with Dir. Map is safe for concurrent use.
func (*Map) Listed ¶
Listed declares a file the caller has seen in a directory listing but not read: it lists and stats as a file (of unknown size, 0), and reading it records it as missing. A directory listing can then be handed over without the contents of every file in it.