file

package
v0.0.0-...-6d46272 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 8 Imported by: 9

Documentation

Overview

Package file implements file utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src, dst string) error

Copy copies a file and writes/overwrites to the destination file.

func CopyAppend

func CopyAppend(src, dst string) error

CopyAppend copies a file and appends to the destination file.

func EnsureExecutable

func EnsureExecutable(p string) error

EnsureExecutable sets the executable file mode bits, for all users, to ensure that we can execute a file

func Exist

func Exist(name string) bool

Exist returns true if a file or directory exists.

func GetTempFilePath

func GetTempFilePath(pfx string) (path string)

GetTempFilePath creates a file path to a temporary file that does not exist yet.

func IsDirWriteable

func IsDirWriteable(dir string) error

IsDirWriteable checks if dir is writable by writing and removing a file. It returns error if dir is NOT writable. If the director does not exist, it returns nil.

func MkDir

func MkDir(baseDir string, pfx string) (dir string)

MkDir creates a directory. If "baseDir" is empty, it uses the os.TempDir.

func WriteTempFile

func WriteTempFile(d []byte) (path string, err error)

WriteTempFile writes data to a temporary file.

func WriteToTempDir

func WriteToTempDir(p string, d []byte) (path string, err error)

WriteToTempDir writes data to a temporary directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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