files

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package files provides standard file functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfExists

func CheckIfExists(dir string) bool

CheckIfExists checks if a file / directory exists

func CopyFileContents

func CopyFileContents(src, dst string) (err error)

CopyFileContents writes the contents to src to a new file dst. This operation is silently destructive

func CreateDirsIfNotExists

func CreateDirsIfNotExists(d []string) error

CreateDirsIfNotExists takes an array of strings contain filepaths and any that for not exist are created.

func CreateMonetConfigFolders

func CreateMonetConfigFolders(configDir string) error

CreateMonetConfigFolders creates the standard directory layout for a monet configuration folder

func DownloadFile

func DownloadFile(url string, writefile string) error

DownloadFile downs a file from a URL and writes it to disk

func LoadToml

func LoadToml(tomlFile string) (*toml.Tree, error)

LoadToml loads a Toml file and returns a tree object.

func SafeRenameDir

func SafeRenameDir(origDir string) error

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 SaveToml

func SaveToml(tree *toml.Tree, tomlFile string) error

SaveToml writes a tree object (back) to a toml file

func WriteToFile

func WriteToFile(filename string, data string) error

WriteToFile writes a string variable to a file. It overwrites any pre-existing data silently.

func WriteToFilePrivate

func WriteToFilePrivate(filename string, data string) error

WriteToFilePrivate writes a string variable to a file with 0600 permissions

Types

This section is empty.

Jump to

Keyboard shortcuts

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