files

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

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

CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.

func CopyDirChildren

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

CopyDirChildren recursively copies a directory tree's children, attempting to preserve permissions. Source directory must exist, destination directory must exist. Symlinks are ignored and skipped.

func CopyFile

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

CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.

func CreateIfNotExist added in v0.12.0

func CreateIfNotExist(path string) error

CreateIfNotExist will create the file at the specific path if it does not exist.

func DeleteIfExists

func DeleteIfExists(path string) (existed bool, err error)

DeleteIfExists will delete a file if it exists. If it doesn't, nothing happens. Returns if the file existed. If there was an error, existed is set to false, and err is set.

func DownloadFile

func DownloadFile(filepath string, url string) error

DownloadFile will download a url to a local file. The network request attaches the "onepanelio" user-agent to the request headers This is important for certain sites like Github, otherwise you get a 403.

func Exists

func Exists(path string) (bool, error)

Exists returns whether the given file or directory exists

func Unzip

func Unzip(src string, dest string) ([]string, error)

Unzip will decompress a zip archive, moving all files and folders Source: https://golangcode.com/unzip-files-in-go/ within the zip file (parameter 1) to an output directory (parameter 2).

Types

type ComponentConfigVar

type ComponentConfigVar struct {
	ComponantPath string
	ConfigVar     *ConfigVar
}

type ConfigVar

type ConfigVar struct {
	Required bool    `yaml:"required"`
	Default  *string `yaml:"default"`
}

func (*ConfigVar) HasDefault

func (c *ConfigVar) HasDefault() bool

Jump to

Keyboard shortcuts

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