files

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: Apache-2.0 Imports: 15 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(dirPath string) error

CheckDir returns nil if the path is a directory

func CheckDirErrPath added in v0.10.0

func CheckDirErrPath(dirPath string, errMsgPath 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 CheckFileErrPath added in v0.10.0

func CheckFileErrPath(path string, errMsgPath string) error

CheckFile returns nil if the path is a file

func CloseSilent

func CloseSilent(closer io.Closer, closers ...io.Closer)

func CreateDir added in v0.14.0

func CreateDir(path string) error

func CreateDirIfMissing

func CreateDirIfMissing(path string) (bool, error)

func CreateFile added in v0.4.0

func CreateFile(path string) error

func DeleteDir added in v0.14.0

func DeleteDir(path string) error

func DeleteDirIfPresent added in v0.14.0

func DeleteDirIfPresent(path string) (bool, error)

func DirPathRelativeToCWD added in v0.13.0

func DirPathRelativeToCWD(absPath string) string

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 ErrorDeleteDir added in v0.14.0

func ErrorDeleteDir(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 EscapeTilde added in v0.14.0

func EscapeTilde(path string) (string, error)

Returns original path if there was an error

func FileTree

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

func IgnoreCortexDebug added in v0.12.0

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

func IgnoreCortexYAML added in v0.8.0

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

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 IsDir

func IsDir(path string) bool

func IsFile

func IsFile(path string) bool

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(path string, paths ...string) error

func MakeEmptyFilesInDir

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

func Open added in v0.4.0

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

func OpenFile added in v0.4.0

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

func OpenNewFile added in v0.14.0

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

func ParentDir

func ParentDir(dir string) string

func PathRelativeToCWD added in v0.13.0

func PathRelativeToCWD(absPath string) string

func ReadFile added in v0.12.0

func ReadFile(path string) (string, error)

func ReadFileBytes added in v0.4.0

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

func ReadFileBytesErrPath added in v0.10.0

func ReadFileBytesErrPath(path string, errMsgPath string) ([]byte, error)

func ReadReqFile

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

ReadReqFile returns nil if no file

func RelToAbsPath added in v0.13.0

func RelToAbsPath(relativePath 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 UserRelToAbsPath added in v0.13.0

func UserRelToAbsPath(relativePath string) string

func WriteFile added in v0.4.0

func WriteFile(data []byte, path string) 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
	ErrDeleteDir
	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 true will ignore all subdirs of dir

func GitIgnoreFn added in v0.14.0

func GitIgnoreFn(gitIgnorePath string) (IgnoreFn, error)

func IgnoreSpecificFiles added in v0.13.0

func IgnoreSpecificFiles(absPaths ...string) IgnoreFn

func PromptForFilesAboveSize added in v0.13.0

func PromptForFilesAboveSize(size int, promptMsgTemplate string) IgnoreFn

promptMsgTemplate should have two placeholders: the first is for the file path and the second is for the file size

Jump to

Keyboard shortcuts

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