package zfs
import "zgo.at/zstd/zfs"
Package zfs provides some extensions to the fs package.
Index ¶
- func EmbedOrDir(e embed.FS, dir string, dev bool) (fs.FS, error)
- func Exists(fsys fs.FS, name string) bool
- func MustReadFile(fsys fs.FS, name string) []byte
- func SubIfExists(fsys fs.FS, dir string) (fs.FS, error)
- type OverlayFS
Functions ¶
func EmbedOrDir ¶
EmbedOrDir returns e if dev is false, or a os.DirFS at the module root.
This is intended to serve files from the local FS when developing and requires to be run in the source code directory.
In both cases it will try to fs.Sub() to dir, but it's a non-fatal error if this directory doesn't exist.
func Exists ¶
Exists reports if this file or directory exists in the given fs.
func MustReadFile ¶
MustReadFile is like fs.ReadFile, but will panic() on errors.
func SubIfExists ¶
SubIfExists will fs.Sub() to a directory only if it exists.
This will continue with the next directory if it doesn't exist. For example with "db/query", it will try to Sub to "db" first, and will continue to Sub to "query" regardless of whether the Sub to "db" succeeded or not, so "db/query" and "query" will end up beiing Sub()'d.
Types ¶
type OverlayFS ¶
type OverlayFS struct {
// contains filtered or unexported fields
}
func NewOverlayFS ¶
OverlayFS returns a filesystem which reads from overlay, falling back to base if that fails.
func (OverlayFS) InBase ¶
InBase reports if this filename exists in the base part. It may or may not exist in the overlay part.
func (OverlayFS) InOverlay ¶
InOverlay reports if this filename exists in the overlay part. It may or may not exist in the base part.
func (OverlayFS) Open ¶
Open implements the fs.FS interface.
func (OverlayFS) ReadDir ¶
ReadDir implements the fs.ReadDirFS interface.
Source Files ¶
zfs.go
- Version
- v0.0.0-20240930202209-a63c3335042a (latest)
- Published
- Sep 30, 2024
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 2 days ago –
Tools for package owners.