avyos.dev/pkg/fs
package fs
Package Overview
No package-level documentation is provided.
| Export Group | Count |
|---|---|
| Constants | 1 |
| Variables | 0 |
| Functions | 15 |
| Types | 3 |
Constants
const (
AvyosPath = "/avyos"
CommandsPath = "/cmd"
ServicesPath = "/services"
CachePath = "/cache"
KernelPath = "/cache/kernel"
DevicesPath = "/cache/kernel/devices"
ProcessesPath = "/cache/kernel/processes"
SysfsPath = "/cache/kernel/sysfs"
RuntimePath = "/cache/runtime"
UserRunPath = "/cache/runtime/user"
ConfigPath = "/config"
UsersHomePath = "/users"
)Functions
func Copy(src, dst string, recursive bool) errorCopy copies a file or directory from src to dst.
func Exists(path string) boolExists checks if a path exists.
func Find(root, pattern string) ([]string, error)Find finds files matching a pattern in a directory.
func IsDir(path string) boolIsDir checks if a path is a directory.
func IsFile(path string) boolIsFile checks if a path is a regular file.
func IsSymlink(path string) boolIsSymlink checks if a path is a symbolic link.
func MkdirAll(path string, perm os.FileMode) errorMkdirAll creates a directory and all parent directories.
func Move(src, dst string) errorMove moves a file or directory from src to dst.
func PermString(mode os.FileMode) stringPermString returns a human-readable permission string (like ls -l).
func ReadLink(path string) (string, error)ReadLink returns the destination of a symbolic link.
func Remove(path string, recursive bool) errorRemove removes a file or directory.
func Resolve(kind string, p ...string) stringfunc Symlink(target, link string) errorSymlink creates a symbolic link.
func Touch(path string) errorTouch creates an empty file or updates the modification time.
func Walk(root string, walkFn WalkFunc) errorWalk walks the file tree rooted at root.
Types
FileInfo
type FileInfo struct {
Name string
Path string
Size int64
Mode os.FileMode
ModTime int64 // Unix timestamp
UID uint32
GID uint32
IsDir bool
IsLink bool
Target string // For symlinks
}FileInfo represents information about a file.
Functions
func Info(path string) (*FileInfo, error)Info returns information about a file.
func ListDir(path string) ([]*FileInfo, error)ListDir lists the contents of a directory.
TreeEntry
type TreeEntry struct {
Info *FileInfo
Children []*TreeEntry
Depth int
}TreeEntry represents an entry in a directory tree.
Functions
func Tree(path string, maxDepth int) (*TreeEntry, error)Tree builds a directory tree.
WalkFunc
type WalkFunc func(path string, info os.FileInfo, err error) errorWalk walks a directory tree, calling walkFn for each file or directory.