file

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteDir

func DeleteDir(path string) error

DeleteDir deletes the directory at the given path. It returns nil if the deletion succeeds, or the deletion error otherwise. If the directory does not exist, DeleteDir returns nil.

func ExpandFileList

func ExpandFileList(fileList []string) ([]string, error)

ExpandFileList takes a list of file globs and expands them into a list of matching file paths. It returns the expanded file list and any errors from glob matching. This allows safely passing user input globs through to glob matching.

func IsDir added in v2.1.0

func IsDir(path string) (bool, error)

IsDir returns whether the given path is a directory. If the path does not exist, it returns (false, nil). If there is an error checking the path, it returns (false, err).

func IsDirEmpty added in v2.2.0

func IsDirEmpty(path string) (bool, error)

IsDirEmpty checks if the directory at the given path is empty. It returns true if the directory is empty, false if not empty, or an error if there was a problem checking it.

func ReadStringOrFile

func ReadStringOrFile(input string) (string, bool, error)

ReadStringOrFile returns the content of a string or a file if the file exists. The returned boolean value indicates whether the specified `input` was a file path or not.

func WriteTmpFile added in v2.3.1

func WriteTmpFile(name, content string) (string, error)

WriteTmpFile creates a temporary file with the given name and content, and returns the path to the created file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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