Documentation
¶
Overview ¶
Package fsx provides path safety, hashing and copy primitives.
Index ¶
- Variables
- func CopyFile(src, dst string, overwrite bool) error
- func Exists(path string) bool
- func HashFile(path string) (string, error)
- func HashTree(root string, files []string) (string, error)
- func ListFiles(root string) ([]string, error)
- func ReadJSON(path string, v any) error
- func SafeJoin(root, rel string) (string, error)
- func WriteJSON(path string, v any) error
Constants ¶
This section is empty.
Variables ¶
var IgnoredDirs = map[string]bool{".git": true, "__pycache__": true}
IgnoredDirs are never hashed, copied or exported as package content.
Functions ¶
func CopyFile ¶
CopyFile copies src to dst preserving the mode; it creates parent directories and refuses to overwrite unless overwrite is true.
func HashTree ¶
HashTree returns one sha256 over the sorted (path, content hash) pairs of the given files under root.
func ListFiles ¶
ListFiles returns every regular file under root as slash-separated paths relative to root, sorted. Symlinks are reported through the error: a package or an export source containing one that escapes root is unsafe.
Types ¶
This section is empty.