fileutil

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

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

func CreateDirAll(dir string) error

CreateDirAll wraps TouchDirAll but returns error if the deepest directory is not empty.

func Exist

func Exist(name string) bool

Exist returns true if a file or directory exists.

func IsDirWriteable

func IsDirWriteable(dir string) error

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

func TouchDirAll(dir string) error

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.

Jump to

Keyboard shortcuts

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