Documentation ¶
Index ¶
- func DownloadFile(url string, filePath string, mode os.FileMode, overwrite bool) error
- func NewDirectory(path string, mode fs.FileMode) (err error)
- func NewFileFromSource(path string, mode fs.FileMode, overwrite bool, source io.Reader) (int64, error)
- func NormalizeFilePath(path string) string
- type FilterSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadFile ¶
DownloadFile places the contents of the given url into a local file at the given path with the given mode. If the overwrite flag is set then any existing files with conflicting names will be overwritten
func NewDirectory ¶
NewDirectory wraps os.Mkdir to provide standardized directory creation and logging
func NewFileFromSource ¶
func NewFileFromSource(path string, mode fs.FileMode, overwrite bool, source io.Reader) (int64, error)
NewFileFrom wraps os.OpenFile and io.Copy to standardize the way the package creates output files. The path argument accepts the file path to the given output file, the mode argument accepts an fs.FileMode which the file will be created with, and overwrite determines whether existing files should be overwritten or and error produced, the source provides the data that will be written to the new file. The bytes written are returned.
func NormalizeFilePath ¶
NormalizeFilePath is a utility function that rewrites file paths specified to ensure that they are relative to the current working directory and don't have names that are potentially a nuisence for users (such as names composed only of whitespace characters, only dots, etc.)