utils

package
v0.0.0-...-5e4c8b9 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgentCurl    = "curl/7.45.0"
	UserAgentFirefox = "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0"
	UserAgentChrome  = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36"
)

Variables

This section is empty.

Functions

func BoolToString

func BoolToString(val bool) string

func CwdDir

func CwdDir() string

func ExpandUser

func ExpandUser(path string) string

ExpandUser is a helper function that expands the first '~' it finds in the passed path with the home directory of the current user.

Note: This only works on environments similar to bash.

func GetBase64Image

func GetBase64Image(body []byte, width, height int) string

func GetExecDir

func GetExecDir() (string, error)

WorkDir returns absolute path of work directory.

func GetExecPath

func GetExecPath() (string, error)

func GetMd5

func GetMd5(str string) string

func GetUTF8HtmlTitle

func GetUTF8HtmlTitle(str string) string

func HttpOpen

func HttpOpen(url string, n time.Duration, agent string) (res *http.Response, body []byte, err error)

func IsDir

func IsDir(filePath string) bool

isDir returns true if given path is a directory, or returns false when it does not exist.

func IsFile

func IsFile(filePath string) bool

isFile returns true if given path is a file, or returns false when it's a directory or does not exist.

func IsValidStatus

func IsValidStatus(status string) bool

func ListDelete

func ListDelete(list []string, key string) []string

func MapDelete

func MapDelete(d interface{}, key string)

func SortMapKeys

func SortMapKeys(dict interface{}) []string

func SplitJID

func SplitJID(jid string) (string, string)

func StringToBool

func StringToBool(val string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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