fileutil

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: MIT Imports: 9 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanSpecial added in v1.0.26

func CleanSpecial(path string) string

func DirExists added in v1.0.37

func DirExists(dir string) (bool, error)

func FileExists added in v1.0.37

func FileExists(file string) (bool, error)

func IsDir added in v1.0.37

func IsDir(file string) (bool, error)

func IsFile added in v1.0.37

func IsFile(file string) (bool, error)

func Patch

func Patch(file string, patch func(data []byte) ([]byte, error)) error

func PatchJSON

func PatchJSON[T any](file string, patch func(v *T) error) error

func PatchJSONPretty

func PatchJSONPretty[T any](file string, patch func(v *T) error) error

func ReadFile added in v1.0.45

func ReadFile(file string) ([]byte, error)

func RebaseAbsPath added in v1.1.1

func RebaseAbsPath(root string, absPath string) string

func RebasePath added in v1.1.1

func RebasePath(root string, path string) string

when doing filepath.Join(a,b), on windows, if b has :, everything fails TODO: test on windows

func Slashlize added in v1.0.51

func Slashlize(path string) string

func UpdateFile added in v1.1.0

func UpdateFile(path string, updateFunc func(content []byte) (bool, []byte, error)) error

func WalkRelative added in v1.0.37

func WalkRelative(root string, h func(path string, relPath string, d fs.DirEntry) error) error

WalkRelative: calculate relative path when walking

func WriteFile added in v1.0.45

func WriteFile(file string, data []byte) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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