file

package
v0.0.0-...-6295505 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

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

Copy copies the file content from src file path to dst file path. If dst does not exist, it is created.

func Copy2

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

Copy2 is Identical to Copy() except that Copy2() also attempts to preserve file metadata.

func CopyMeta

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

CopyMeta clones the uid, gid, mtime and mode from src to dst

func CopyOwnership

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

func Exists

func Exists(path string) bool

Exists returns true if the file path exists.

func ExistsAndDir

func ExistsAndDir(path string) (bool, error)

ExistsAndDir returns true if the file path exists and is a directory.

func ExistsAndRegular

func ExistsAndRegular(path string) (bool, error)

ExistsAndRegular returns true if the file path exists and is a regular file.

func ExistsAndSymlink(path string) (bool, error)

ExistsAndSymlink returns true if the file path exists and is a symbolic link.

func ExistsNotDir

func ExistsNotDir(path string) (bool, error)

ExistsNotDir returns true if the file path exists and is not a directory.

func HaveSameMD5

func HaveSameMD5(opts ...interface{}) bool

HaveSameMD5 accepts a variadic list of options. Each option can be either a []byte format md5 or a file path. In the latter case, the md5 is computed inline to compare with the previous known md5.

HaveSameMD5 returns true if all options refer directly or indirectly to the same md5 checksum.

func IsBlockDevice

func IsBlockDevice(p string) (bool, error)

func IsCharDevice

func IsCharDevice(p string) (bool, error)

func IsDevice

func IsDevice(p string) (bool, error)

func IsMode

func IsMode(p string, mode os.FileMode) (bool, error)

IsMode returns true if the file current mode is the same as the target mode.

func IsNotDir

func IsNotDir(err error) bool

func IsPerm

func IsPerm(p string, perm os.FileMode) (bool, error)

IsPerm returns true if the file current permissions are the same as the target.

func IsProtected

func IsProtected(fpath string) bool

IsProtected returns true if the file is too critical to alter or remove

func MD5

func MD5(p string) ([]byte, error)

MD5 returns the []byte format md5 of the content of the file at path p.

func MD5Reader

func MD5Reader(r io.Reader) ([]byte, error)

func ModTime

func ModTime(p string) (mtime time.Time)

ModTime returns the file modification time or a zero time.

func Mode

func Mode(p string) (os.FileMode, error)

Mode returns the FileMode of the file.

func Ownership

func Ownership(p string) (uid, gid int, err error)

Ownership returns the uid and gid owning the file

func Touch

func Touch(p string, tm time.Time) error

Touch updates the atime and mtime of an existing file, or creates the file if it does not exist yet.

Types

This section is empty.

Jump to

Keyboard shortcuts

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