fsutil

package
v7.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFileForcefully

func CopyFileForcefully(fs afero.Fs, dst, src string, perms os.FileMode) error

CopyFileForcefully copies src to dst, overwriting dst if it exists.

func EnsureDirExistsWithCorrectPermissions

func EnsureDirExistsWithCorrectPermissions(fs afero.Fs, dir string, perms os.FileMode) error

EnsureDirExistsWithCorrectPermissions ensures the dir exists with the correct permissions

func FileExists

func FileExists(fs afero.Fs, file string) bool

FileExists returns true if file exists and is a regular file, else false

func IsEmpty

func IsEmpty(name string) (bool, error)

IsEmpty returns true if the directory passed in contains no files

func WriteNewFile

func WriteNewFile(fs afero.Fs, filename string, data []byte, perms os.FileMode) error

WriteNewFile writes data to the file specified by filename. If the file already exists, then an error will be returned.

func WriteNewFileAtomic

func WriteNewFileAtomic(fs afero.Fs, filename string, data []byte, perms os.FileMode) error

WriteNewFileAtomic writes data first to a temporary file (in the same directory as the desired file) and then moves it to filename. To a consumer of the file located at filename, it appears that the file was created with the given data atomically (rather than being opened/created and subsequently written to). Like WriteNewFile, this function will error out if the destination file already exists.

Types

This section is empty.

Jump to

Keyboard shortcuts

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