elfs

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// sniff Length, use for detect file mime type
	MimeSniffLen = 512
)

Variables

View Source
var Clean = filepath.Clean
View Source
var ErrBadPattern = filepath.ErrBadPattern
View Source
var EvalSymlinks = filepath.EvalSymlinks
View Source
var FromSlash = filepath.FromSlash
View Source
var IsAbs = filepath.IsAbs
View Source
var ListSeparator = filepath.ListSeparator
View Source
var Match = filepath.Match
View Source
var Separator = filepath.Separator
View Source
var SkipDir = filepath.SkipDir
View Source
var Split = filepath.Split
View Source
var SplitList = filepath.SplitList
View Source
var ToSlash = filepath.ToSlash
View Source
var VolumeName = filepath.VolumeName

Functions

func CopyFile

func CopyFile(source, dest string) (bool, error)

Copy file

func DeleteIfFileExist

func DeleteIfFileExist(filename string) error

DeleteIfFileExist operate

func FileExists

func FileExists(path string) bool

FileExists reports whether the named file or directory exists.

func FileSize

func FileSize(filename string) (int64, error)

Get the size of file as byte.

func GetFileExt

func GetFileExt(filename string) string

Get filename extension

func GetTempDir

func GetTempDir() string

GetTempDir returns the default directory to use for temporary files.

func Home

func Home() string

Home returns the os-specific home path as specified in the environment.

func IsDir

func IsDir(path string) bool

IsDir reports whether the named directory exists.

func IsFile

func IsFile(path string) bool

IsFile reports whether the named file or directory exists.

func IsImageFile

func IsImageFile(path string) bool

IsImageFile check file is image file.

func JoinMulti added in v0.1.3

func JoinMulti(path string, items ...string) string

Join File path list

func MimeType

func MimeType(path string) (mime string)

MimeType get File Mime Type name. eg "image/png"

func ParentDir

func ParentDir(path string) (string, error)

Get the path of parent directory.

func PathExists

func PathExists(path string) bool

PathExists reports whether the named file or directory exists.

func ReaderMimeType

func ReaderMimeType(r io.Reader) (mime string)

ReaderMimeType get the io.Reader mimeType Usage:

file, err := os.Open(filepath)
if err != nil {
	return
}
mime := ReaderMimeType(file)

func SelfDir

func SelfDir() (path string, err error)

SelfDir returns The directory that contains the executable file. If current executable is an symbolic link, Return the real path to the directory that contains the executable.

func SetHome

func SetHome(s string) error

SetHome sets the os-specific home path in the environment.

Types

type WalkFunc

type WalkFunc = filepath.WalkFunc

Jump to

Keyboard shortcuts

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