files

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src, dst string) error

Copy copies a file from the source path to the destination path, preserving the file mode of the source file. It expands environment variables in the provided source and destination paths before processing. If the destination directory does not exist, it creates the directory structure.

func Create

func Create(path string, newContent []byte) error

Create creates a file at the specified path with the given content. It expands environment variables in the path and ensures the parent directory exists.

func Exists

func Exists(path string) bool

func ListDirs

func ListDirs(path string) ([]string, error)

func LoadYAML

func LoadYAML(path string, v any) error

LoadYAML reads a YAML file from the given path and unmarshals its content into the provided variable `v`.

func Read

func Read(path string) ([]byte, error)

func ReadString

func ReadString(path string) (string, error)
func Search(rootPath, fileName string, opts ...SearchOption) ([]string, error)

Search searches for a file in a given path and returns a list of files that match the given file name.

Types

type SearchOption

type SearchOption func(*searchOptions)

func WithOmit

func WithOmit(omit ...string) SearchOption

Jump to

Keyboard shortcuts

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