Documentation
¶
Overview ¶
Package fileutil implements some file utils.
Index ¶
Constants ¶
View Source
const ( // PrivateFileMode represents file read/write mode to owner. PrivateFileMode = 0600 // PrivateDirMode represents file make/remove mode in the directory to owner. PrivateDirMode = 0700 )
Variables ¶
This section is empty.
Functions ¶
func CreateDirAll ¶
CreateDirAll wraps TouchDirAll but returns error if the deepest directory is not empty.
func IsDirWriteable ¶
IsDirWriteable checks if dir is writable by writing and removing a file to dir.
func ReadDir ¶
func ReadDir(d string, opts ...func(*ReadDirOperation)) ([]string, error)
ReadDir returns the file names in the provided directory in order.
func TouchDirAll ¶
TouchDirAll creates directories with 0700 permission if any directory does not exist and ensures the provided directory is writable.
func WithExt ¶
func WithExt(ext string) func(*ReadDirOperation)
WithExt filters file names by extension.
Types ¶
type ReadDirOperation ¶
type ReadDirOperation struct {
// contains filtered or unexported fields
}
ReadDirOperation represents read-directory operation.
Click to show internal directories.
Click to hide internal directories.