fileutil

package
v1.0.0-beta.0.rc Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) error

CopyFile copy a file from source to destination path.

func ExpandPath

func ExpandPath(p string) (string, error)

ExpandPath given a string which may be a relative path. 1. replace tilde with users home dir 2. expands embedded environment variables 3. cleans the path, e.g. /a/b/../c -> /a/c Note, it has limitations, e.g. ~someuser/tmp will not be expanded

func FileExists

func FileExists(filename string) bool

FileExists returns true if a file is not a directory and exists at the specified path.

func HasDir

func HasDir(dirPath string) (bool, error)

HasDir checks if a directory indeed exists at the specified path.

func HomeDir

func HomeDir() string

HomeDir for a user.

func ReadFileAsBytes

func ReadFileAsBytes(filename string) ([]byte, error)

ReadFileAsBytes expands a file name's absolute path and reads it as bytes from disk.

Types

This section is empty.

Jump to

Keyboard shortcuts

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