TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/superfly/sprites-go/llms.txt
Use this file to discover all available pages before exploring further.
FS interface exposes a sprite’s filesystem to your Go program. It satisfies the standard library’s io/fs.FS, fs.StatFS, fs.ReadFileFS, and fs.ReadDirFS interfaces, so it works with any code that accepts those types. Write operations — creating files, directories, renaming, copying, and changing permissions — are added on top. Obtain an FS value by calling Sprite.Filesystem() or Sprite.FilesystemAt().
Interface definition
Read operations
Open
io/fs.FS. Returns an fs.File which is an fs.ReadDirFile for directories.
Path to the file or directory. Must not start with
/ when using the standard fs.FS convention.Open file handle. Call
Close() when done.*fs.PathError wrapping fs.ErrNotExist if the path does not exist.Stat
fs.StatFS.
Path to stat.
File metadata including name, size, mode, modification time, and whether it is a directory.
*fs.PathError wrapping fs.ErrNotExist if the path does not exist.ReadFile
fs.ReadFileFS.
Path to the file to read.
Complete file contents.
*fs.PathError if the file cannot be read.ReadDir
fs.ReadDirFS.
Path to the directory to list.
Directory entries. Each entry exposes
Name(), IsDir(), Type(), and Info().*fs.PathError wrapping fs.ErrNotExist if the directory does not exist.Write operations
WriteFile
data to the named file, creating it if it does not exist and overwriting it if it does. Parent directories are created automatically. Uses a background context; prefer WriteFileContext for cancellation support.
Destination path.
Bytes to write.
Permission bits for the file (e.g.,
0644).Mkdir
MkdirAll).
Path of the directory to create.
Permission bits (e.g.,
0755).MkdirAll
path, including any necessary parent directories. Equivalent to Mkdir in the current implementation.
Full directory path to create.
Permission bits.
Remove
Path to remove.
*fs.PathError wrapping fs.ErrNotExist if the path does not exist.RemoveAll
Path to remove recursively.
Rename
oldname to newname. Works for both files and directories.
Current path.
Destination path.
Copy
src to dst. Directories are copied recursively.
Source file or directory path.
Destination path.
Chmod
Path to update.
New permission bits (e.g.,
0755).Context variants
Each write method that may be slow has a context-aware counterpart. Pass a context with a deadline or cancellation to abort long-running operations.WriteFileContext
Context for the HTTP request. Cancelling aborts the upload.
Destination path.
Bytes to write.
Permission bits.
RemoveContext
Remove.
Context for the request.
Path to remove.
RemoveAllContext
RemoveAll.
Context for the request.
Path to remove recursively.
CopyContext
Copy.
Context for the request.
Source path.
Destination path.
ChmodContext
Chmod.
Context for the request.
Path to update.
New permission bits.
Usage with standard library
BecauseFS implements io/fs.FS, you can pass it to any standard library function that accepts that interface: