util

package
v1.0.5-0...-fc905a9 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PathSeparatorString = fmt.Sprintf("%c", os.PathSeparator)
)

Functions

func Cloak

func Cloak(text string) (string, error)

Simple obfuscation function to help avoid over-the-shoulder viewing of passwords and other data. Not intended to be cryptographically secure.

func CompareDir

func CompareDir(a, b string) (bool, error)

func CompareFileContents

func CompareFileContents(a, b string) (bool, error)

func CopyDir

func CopyDir(src string, dst string) error

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

func CopyFile

func CopyFile(src, dst string) 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 DownloadFile

func DownloadFile(uri, username, password, targetPath string) error

func GetMD5Walker

func GetMD5Walker(basePath string, h hash.Hash) func(fp string, fi os.FileInfo, err error) error

func GzipFile

func GzipFile(source, target string) error

func HttpExists

func HttpExists(uri, username, password string) (bool, error)

func MD5Dir

func MD5Dir(basePath string) ([]byte, error)

func MD5File

func MD5File(filePath string, h hash.Hash) error

func MergeMaps

func MergeMaps(maps ...map[string]string) map[string]string

func PathExists

func PathExists(name string) bool

func RunCommand

func RunCommand(cwd string, env []string, cmd string, args ...string) (string, string, error)

func TarDir

func TarDir(source, target string) error

func Uncloak

func Uncloak(text string) (string, error)

Simple obfuscation function to help avoid over-the-shoulder viewing of passwords and other data. No intended to be cryptographically secure.

func UngzipFile

func UngzipFile(source, target string) error

func UntarDir

func UntarDir(tarball, target string) error

func UnzipDir

func UnzipDir(archive, target string) error

func UploadFile

func UploadFile(uri, username, password, filepath string) error

func ZipDir

func ZipDir(source, target string, compress bool) error

Types

type CustomFileInfo

type CustomFileInfo struct {
	// contains filtered or unexported fields
}

func CopyFileInfo

func CopyFileInfo(fi fs.FileInfo) *CustomFileInfo

func (CustomFileInfo) IsDir

func (c CustomFileInfo) IsDir() bool

func (CustomFileInfo) ModTime

func (c CustomFileInfo) ModTime() time.Time

func (CustomFileInfo) Mode

func (c CustomFileInfo) Mode() fs.FileMode

func (CustomFileInfo) Name

func (c CustomFileInfo) Name() string

func (CustomFileInfo) Size

func (c CustomFileInfo) Size() int64

func (CustomFileInfo) Sys

func (c CustomFileInfo) Sys() interface{}

Jump to

Keyboard shortcuts

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