fs

package
v0.0.0-...-143e6d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src, dst string, recursive bool) error

Copy copies a file or directory from src to dst.

func Exists

func Exists(path string) bool

Exists checks if a path exists.

func Find

func Find(root, pattern string) ([]string, error)

Find finds files matching a pattern in a directory.

func IsDir

func IsDir(path string) bool

IsDir checks if a path is a directory.

func IsFile

func IsFile(path string) bool

IsFile checks if a path is a regular file.

func IsSymlink(path string) bool

IsSymlink checks if a path is a symbolic link.

func MkdirAll

func MkdirAll(path string, perm os.FileMode) error

MkdirAll creates a directory and all parent directories.

func Move

func Move(src, dst string) error

Move moves a file or directory from src to dst.

func PermString

func PermString(mode os.FileMode) string

PermString 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

func Remove(path string, recursive bool) error

Remove removes a file or directory.

func Resolve

func Resolve(format string, args ...any) string
func Symlink(target, link string) error

Symlink creates a symbolic link.

func Touch

func Touch(path string) error

Touch creates an empty file or updates the modification time.

func Walk

func Walk(root string, walkFn WalkFunc) error

Walk walks the file tree rooted at root.

Types

type 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.

func Info

func Info(path string) (*FileInfo, error)

Info returns information about a file.

func ListDir

func ListDir(path string) ([]*FileInfo, error)

ListDir lists the contents of a directory.

type TreeEntry

type TreeEntry struct {
	Info     *FileInfo
	Children []*TreeEntry
	Depth    int
}

TreeEntry represents an entry in a directory tree.

func Tree

func Tree(path string, maxDepth int) (*TreeEntry, error)

Tree builds a directory tree.

type WalkFunc

type WalkFunc func(path string, info os.FileInfo, err error) error

Walk walks a directory tree, calling walkFn for each file or directory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL