Documentation
¶
Overview ¶
Package fsext provides filesystem extensions for working with embedded files.
It includes utilities for copying files from embed.FS to the OS filesystem and reading embedded content.
Index ¶
- func CopyAllEmbed(efs embed.FS, destDir string) error
- func CopyFromEmbed(fsx fs.FS, srcDir, destDir string) error
- func DirExists(fs afero.Fs, path string) bool
- func EnsureDir(fs afero.Fs, filePath string) error
- func Exists(fs afero.Fs, path string) bool
- func MustReadFromEmbed(fs embed.FS, name string) string
- func ReadFromEmbed(fs embed.FS, name string) (string, error)
- type FS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyAllEmbed ¶
CopyAllEmbed copies everything from the root of the embedded FS to destDir.
func CopyFromEmbed ¶
CopyFromEmbed recursively copies all files from an embed.FS directory to a destination.
func DirExists ¶ added in v0.1.0
DirExists checks if a directory exists, ignoring any errors.
Returns true if the directory exists, false otherwise.
func EnsureDir ¶ added in v0.1.0
EnsureDir ensures the parent directory of the given file path exists.
Returns an error if the directory cannot be created.
func Exists ¶ added in v0.1.0
Exists checks if a path exists, ignoring any errors.
Returns true if the path exists, false otherwise.
func MustReadFromEmbed ¶ added in v0.0.8
MustReadFromEmbed reads a file from an embedded filesystem and returns its contents as a string.
Panics if the file cannot be read.