Documentation ¶
Index ¶
- func DirExists(fs utilfs.Filesystem, path string) (bool, error)
- func EnsureDir(fs utilfs.Filesystem, path string) error
- func EnsureFile(fs utilfs.Filesystem, path string) error
- func FileExists(fs utilfs.Filesystem, path string) (bool, error)
- func ReplaceFile(fs utilfs.Filesystem, path string, data []byte) error
- func WriteTmpFile(fs utilfs.Filesystem, path string, data []byte) (tmpPath string, retErr error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirExists ¶
func DirExists(fs utilfs.Filesystem, path string) (bool, error)
DirExists returns true if a directory exists at `path`, false if `path` does not exist, otherwise an error
func EnsureDir ¶
func EnsureDir(fs utilfs.Filesystem, path string) error
EnsureDir ensures that a directory exists at `path`, and if it must create the directory any necessary parent directories will also be created and the new directory will be empty.
func EnsureFile ¶
func EnsureFile(fs utilfs.Filesystem, path string) error
EnsureFile ensures that a regular file exists at `path`, and if it must create the file any necessary parent directories will also be created and the new file will be empty.
func FileExists ¶
func FileExists(fs utilfs.Filesystem, path string) (bool, error)
FileExists returns true if a regular file exists at `path`, false if `path` does not exist, otherwise an error
func ReplaceFile ¶
func ReplaceFile(fs utilfs.Filesystem, path string, data []byte) error
ReplaceFile replaces the contents of the file at `path` with `data` by writing to a tmp file in the same dir as `path` and renaming the tmp file over `path`. The file does not have to exist to use ReplaceFile. Note ReplaceFile calls fsync.
func WriteTmpFile ¶ added in v1.9.1
WriteTmpFile creates a temporary file at `path`, writes `data` into it, and fsyncs the file
Types ¶
This section is empty.