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 ¶
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 ¶
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 ¶
func IsExistsFile ¶
IsExistsFile check file exists and is a file
func MapToStruct ¶
func Match ¶
Match url with pattern by chrome extension match pattern style https://developer.chrome.com/docs/extensions/mv3/match_patterns/
func ParseDataUri ¶
ParseDataUri parses a data URI and returns the MIME type and decode data.
func ParseSchema ¶
func ReplaceInvalidFilename ¶
ReplaceInvalidFilename replace invalid path characters
func RmAndMkDirAll ¶
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.