Documentation ¶
Index ¶
- Constants
- func BuildProxyUrl(scheme, host, usr, pwd string) *url.URL
- func ByteFmt(size int64) string
- func CheckDuplicateAndRename(path string) (string, error)
- func CopyDir(source string, target string, excludeDir ...string) error
- func CreateDirIfNotExist(dir string) error
- func Dir(path string) string
- func Filepath(path string, originName string, customName string) string
- func IsExistsFile(path string) bool
- func MapToStruct(s any, v any) error
- func Match(pattern string, u string) bool
- func ParseDataUri(uri string) (string, []byte)
- func ParseSchema(url string) string
- func ReplaceInvalidFilename(path string) string
- func RmAndMkDirAll(path string) error
- func SafeRemove(name string) error
- type Timer
Constants ¶
const FileSchema = "FILE"
Variables ¶
This section is empty.
Functions ¶
func BuildProxyUrl ¶ added in v1.5.1
BuildProxyUrl builds a proxy url with given host, username and password.
func CheckDuplicateAndRename ¶
CheckDuplicateAndRename rename duplicate file, add suffix (1) (2) ... if file name is a.txt, rename to a (1).txt if directory name is a, rename to a (1) return new name
func CopyDir ¶ added in v1.4.0
CopyDir Copy all files to the target directory, if the file already exists, it will be overwritten. Remove target file if the source file is not exist.
func CreateDirIfNotExist ¶ added in v1.3.5
func IsExistsFile ¶ added in v1.3.8
IsExistsFile check file exists and is a file
func MapToStruct ¶
func Match ¶ added in v1.4.0
Match url with pattern by chrome extension match pattern style https://developer.chrome.com/docs/extensions/mv3/match_patterns/
func ParseDataUri ¶ added in v1.3.8
ParseDataUri parses a data URI and returns the MIME type and decode data.
func ParseSchema ¶
func ReplaceInvalidFilename ¶ added in v1.5.2
ReplaceInvalidFilename replace invalid path characters
func RmAndMkDirAll ¶ added in v1.4.0
RmAndMkDirAll remove and create directory, if the directory already exists, it will be overwritten.
func SafeRemove ¶
SafeRemove remove file safely, ignoring errors if the path does not exist.