Documentation
¶
Overview ¶
Package files provides standard file functions
Index ¶
- func CheckIfExists(dir string) bool
- func CopyFileContents(src, dst string) (err error)
- func CreateDirsIfNotExists(d []string) error
- func CreateMonetConfigFolders(configDir string) error
- func DownloadFile(url string, writefile string) error
- func LoadToml(tomlFile string) (*toml.Tree, error)
- func SafeRenameDir(origDir string) error
- func SaveToml(tree *toml.Tree, tomlFile string) error
- func WriteToFile(filename string, data string) error
- func WriteToFilePrivate(filename string, data string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckIfExists ¶
CheckIfExists checks if a file / directory exists
func CopyFileContents ¶
CopyFileContents writes the contents to src to a new file dst. This operation is silently destructive
func CreateDirsIfNotExists ¶
CreateDirsIfNotExists takes an array of strings contain filepaths and any that for not exist are created.
func CreateMonetConfigFolders ¶
CreateMonetConfigFolders creates the standard directory layout for a monet configuration folder
func DownloadFile ¶
DownloadFile downs a file from a URL and writes it to disk
func SafeRenameDir ¶
SafeRenameDir renames a folder to folder.~n~ where n is the lowest value where the folder does not already exist. n is capped at 100 - which would require the user to manually tidy the parent folder.
func WriteToFile ¶
WriteToFile writes a string variable to a file. It overwrites any pre-existing data silently.
func WriteToFilePrivate ¶
WriteToFilePrivate writes a string variable to a file with 0600 permissions
Types ¶
This section is empty.