fileutil

package
v0.0.0-...-2f989cd Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirExist

func DirExist(name string, fs vfs.FS) (result bool, err error)

DirExist returns whether the specified filesystem entry exists.

func Mkdir

func Mkdir(dir string, fs vfs.FS) error

Mkdir creates the specified dir.

func MkdirAll

func MkdirAll(dir string, fs vfs.FS) error

MkdirAll creates the specified dir along with any necessary parents.

func MustWrite

func MustWrite(w io.Writer, data []byte)

MustWrite writes the specified data to the input writer. It will panic if there is any error.

func SyncDir

func SyncDir(dir string, fs vfs.FS) (err error)

SyncDir calls fsync on the specified directory.

func TempDir

func TempDir(dir, pattern string, fs vfs.FS) (name string, err error)

TempDir creates a new temporary directory in the directory dir. The directory name is generated by taking pattern and applying a random string to the end. If pattern includes a "*", the random string replaces the last "*". TempDir returns the name of the new directory. If dir is the empty string, TempDir uses the default directory for temporary files (see os.TempDir). Multiple programs calling TempDir simultaneously will not choose the same directory. It is the caller's responsibility to remove the directory when no longer needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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