files

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDir added in v0.4.0

func CheckDir(path string) error

CheckDir returns nil if the path is a directory

func CheckFile added in v0.4.0

func CheckFile(path string) error

CheckFile returns nil if the path is a file

func CloseSilent

func CloseSilent(closers ...io.Closer)

func CreateDirIfMissing

func CreateDirIfMissing(path string) (bool, error)

func CreateFile added in v0.4.0

func CreateFile(path string) (*os.File, error)

func DirPaths

func DirPaths(paths []string, addTrailingSlash bool) []string

func ErrorCreateDir added in v0.4.0

func ErrorCreateDir(path string) error

func ErrorCreateFile added in v0.4.0

func ErrorCreateFile(path string) error

func ErrorDirDoesNotExist added in v0.4.0

func ErrorDirDoesNotExist(path string) error

func ErrorFileAlreadyExists added in v0.4.0

func ErrorFileAlreadyExists(path string) error

func ErrorFileDoesNotExist added in v0.4.0

func ErrorFileDoesNotExist(path string) error

func ErrorNotADir added in v0.4.0

func ErrorNotADir(path string) error

func ErrorNotAFile added in v0.4.0

func ErrorNotAFile(path string) error

func ErrorReadDir added in v0.4.0

func ErrorReadDir(path string) error

func ErrorReadFile added in v0.4.0

func ErrorReadFile(path string) error

func ErrorReadFormFile added in v0.4.0

func ErrorReadFormFile(fileName string) error

func ErrorUnexpected added in v0.4.0

func ErrorUnexpected() error

func FileTree

func FileTree(paths []string, cwd string, dirsOrder DirsOrder) string

func IgnoreHiddenFiles

func IgnoreHiddenFiles(path string, fi os.FileInfo) (bool, error)

func IgnoreHiddenFolders

func IgnoreHiddenFolders(path string, fi os.FileInfo) (bool, error)

func IgnoreNonPython

func IgnoreNonPython(path string, fi os.FileInfo) (bool, error)

func IgnoreNonYAML

func IgnoreNonYAML(path string, fi os.FileInfo) (bool, error)

func IgnorePythonGeneratedFiles

func IgnorePythonGeneratedFiles(path string, fi os.FileInfo) (bool, error)

func IsFileOrDir

func IsFileOrDir(path string) bool

func IsFilePathPython

func IsFilePathPython(path string) bool

func IsFilePathYAML

func IsFilePathYAML(path string) bool

func ListDir

func ListDir(dir string, relative bool) ([]string, error)

func ListDirRecursive

func ListDirRecursive(dir string, relative bool, ignoreFns ...IgnoreFn) ([]string, error)

func MakeEmptyFile

func MakeEmptyFile(path string) error

func MakeEmptyFiles

func MakeEmptyFiles(paths ...string) error

func MakeEmptyFilesInDir

func MakeEmptyFilesInDir(dir string, paths ...string) error

func MkdirAll added in v0.4.0

func MkdirAll(path string, perm os.FileMode) error

func Open added in v0.4.0

func Open(path string) (*os.File, error)

func OpenFile added in v0.4.0

func OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)

func ParentDir

func ParentDir(dir string) string

func ReadFileBytes added in v0.4.0

func ReadFileBytes(path string) ([]byte, error)

func ReadReqFile

func ReadReqFile(r *http.Request, fileName string) ([]byte, error)

ReadReqFile returns nil if no file

func RelPath

func RelPath(userPath string, baseDir string) string

func SearchForFile

func SearchForFile(filename string, dir string) (string, error)

func SortFilePaths

func SortFilePaths(paths []string, dirsOrder DirsOrder) []string

func TmpDir

func TmpDir() (string, error)

func TrimDirPrefix

func TrimDirPrefix(fullPath string, dirPath string) string

func UserPath

func UserPath(userPath string) string

func WriteFile added in v0.4.0

func WriteFile(filename string, data []byte, perm os.FileMode) error

Types

type DirsOrder

type DirsOrder string
var DirsOnBottom DirsOrder = "bottom"
var DirsOnTop DirsOrder = "top"
var DirsSorted DirsOrder = "sorted"

type Error added in v0.4.0

type Error struct {
	Kind ErrorKind
	// contains filtered or unexported fields
}

func (Error) Error added in v0.4.0

func (e Error) Error() string

type ErrorKind added in v0.4.0

type ErrorKind int
const (
	ErrUnknown ErrorKind = iota
	ErrCreateDir
	ErrReadFormFile
	ErrCreateFile
	ErrReadDir
	ErrReadFile
	ErrFileAlreadyExists
	ErrUnexpected
	ErrFileDoesNotExist
	ErrDirDoesNotExist
	ErrNotAFile
	ErrNotADir
)

func (ErrorKind) MarshalBinary added in v0.4.0

func (t ErrorKind) MarshalBinary() ([]byte, error)

MarshalBinary satisfies BinaryMarshaler

func (ErrorKind) MarshalText added in v0.4.0

func (t ErrorKind) MarshalText() ([]byte, error)

MarshalText satisfies TextMarshaler

func (ErrorKind) String added in v0.4.0

func (t ErrorKind) String() string

func (*ErrorKind) UnmarshalBinary added in v0.4.0

func (t *ErrorKind) UnmarshalBinary(data []byte) error

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*ErrorKind) UnmarshalText added in v0.4.0

func (t *ErrorKind) UnmarshalText(text []byte) error

UnmarshalText satisfies TextUnmarshaler

type IgnoreFn

type IgnoreFn func(string, os.FileInfo) (bool, error)

IgnoreFn if passed a dir, returning false will ignore all subdirs of dir

Jump to

Keyboard shortcuts

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