Documentation
¶
Index ¶
- Variables
- func Create(path string) (*os.File, error)
- func EnsureDir(ctx context.Context, elems ...string) error
- func FileExists(path string) bool
- func GetFileName(rn *yaml.RNode) (string, error)
- func IsDir(path string) bool
- func NormalizeDir(dirPath string) (string, error)
- func OpenFile(path string, flag int, perm fs.FileMode) (*os.File, error)
- func PathExists(path string) bool
- type Directory
- type FS
- type Printer
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPathNoDirectory = errors.New("invalid path, path needs a specific directory")
Functions ¶
func FileExists ¶ added in v0.0.3
fileExists returns true if a file at path already exists; false otherwise.
func IsDir ¶ added in v0.0.3
IsDir returns true if path represents a directory in the fileSystem otherwise false is returned
func NormalizeDir ¶ added in v0.0.3
NormalizeDir returns full absolute directory path of the passed directory or an error. This function cleans up paths such as current directory (.), relative directories (..), or multiple separators.
func PathExists ¶ added in v0.0.15
PathExists returns true if the path already exists; false otherwise.
Types ¶
type Directory ¶ added in v0.0.3
type Directory struct {
Path string
}
Directory creates a new temp directory, in which files get created.
func CreateTempDirectory ¶ added in v0.0.3
CreateDirectory does create the actual disk directory, and return a new representation of it.
type FS ¶
type FS interface {
Open(path string) (fs.File, error)
// Readfile returns the content of a given file
ReadFile(path string) ([]byte, error)
// WriteFile writes the data to a file at the given path,
// it overwrites existing content
WriteFile(path string, data []byte, perm fs.FileMode) error
// Calculate a sha256 cheksum on the file
Sha256(path string) (string, error)
// Walk walks the file system with the given WalkDirFunc.
Walk(path string, walkFn fs.WalkDirFunc) error
// Exists is true if the path exists in the file system.
Exists(path string) bool
// Stat returns a FileInfo describing the named file from the file system.
Stat(path string) (fs.FileInfo, error)
// Glob returns the list of matching files,
// emulating https://golang.org/pkg/path/filepath/#Glob
Glob(pattern string) ([]string, error)
}
Click to show internal directories.
Click to hide internal directories.