Imports #
"errors"
"internal/bytealg"
"internal/stringslite"
"io"
"io/fs"
"time"
"errors"
"internal/bytealg"
"internal/stringslite"
"io"
"io/fs"
"time"
var _ fs.ReadDirFS = FS{...}
var _ fs.ReadFileFS = FS{...}
var _ fs.FileInfo = *ast.CallExpr
var _ fs.DirEntry = *ast.CallExpr
var _ io.Seeker = *ast.CallExpr
var _ io.ReaderAt = *ast.CallExpr
dotFile is a file for the root directory, which is omitted from the files list in a FS.
var dotFile = *ast.UnaryExpr
An FS is a read-only collection of files, usually initialized with a //go:embed directive. When declared without a //go:embed directive, an FS is an empty file system. An FS is a read-only value, so it is safe to use from multiple goroutines simultaneously and also safe to assign values of type FS to each other. FS implements fs.FS, so it can be used with any package that understands file system interfaces, including net/http, text/template, and html/template. See the package documentation for more details about initializing an FS.
type FS struct {
files *[]file
}
A file is a single file in the FS. It implements fs.FileInfo and fs.DirEntry.
type file struct {
name string
data string
hash [16]byte
}
An openDir is a directory open for reading.
type openDir struct {
f *file
files []file
offset int
}
An openFile is a regular file open for reading.
type openFile struct {
f *file
offset int64
}
func (f *openFile) Close() error
func (d *openDir) Close() error
func (f *file) Info() (fs.FileInfo, error)
func (f *file) IsDir() bool
func (f *file) ModTime() time.Time
func (f *file) Mode() fs.FileMode
func (f *file) Name() string
Open opens the named file for reading and returns it as an [fs.File]. The returned file implements [io.Seeker] and [io.ReaderAt] when the file is not a directory.
func (f FS) Open(name string) (fs.File, error)
func (d *openDir) Read([]byte) (int, error)
func (f *openFile) Read(b []byte) (int, error)
func (f *openFile) ReadAt(b []byte, offset int64) (int, error)
func (d *openDir) ReadDir(count int) ([]fs.DirEntry, error)
ReadDir reads and returns the entire named directory.
func (f FS) ReadDir(name string) ([]fs.DirEntry, error)
ReadFile reads and returns the content of the named file.
func (f FS) ReadFile(name string) ([]byte, error)
func (f *openFile) Seek(offset int64, whence int) (int64, error)
func (f *file) Size() int64
func (f *openFile) Stat() (fs.FileInfo, error)
func (d *openDir) Stat() (fs.FileInfo, error)
func (f *file) String() string
func (f *file) Sys() any
func (f *file) Type() fs.FileMode
lookup returns the named file, or nil if it is not present.
func (f FS) lookup(name string) *file
readDir returns the list of files corresponding to the directory dir.
func (f FS) readDir(dir string) []file
sortSearch is like sort.Search, avoiding an import.
func sortSearch(n int, f func(int) bool) int
split splits the name into dir and elem as described in the comment in the FS struct above. isDir reports whether the final trailing slash was present, indicating that name is a directory.
func split(name string) (dir string, elem string, isDir bool)
Generated with Arrow