Documentation
¶
Overview ¶
Package favicon provides a favicon downloader
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Download ¶
Download tries to download the favicon with highest resolution for the specified host By default it looks into the standard locations - http://<host>/apple-touch-icon.png - http://<host>/favicon.ico - http://<host>/favicon.png Alternatively a third-party service can be used via the Service option. Example: // Use the DuckDuckGo service
ddg := func(host string) string { return fmt.Sprintf("https://icons.duckduckgo.com/ip3/%s.ico", host) } img, err := favicon.Download(e.ctx, host, favicon.Options{ ForceMinSize: true, Service: ddg, })
Types ¶
type Options ¶
type Options struct { // Client is http.Client used to download the favicon. Leave nil to use the // http.Default with a timeout of 10 seconds Client *http.Client // MinSize is the min size of the favicon to be considered valid. // favicon smaller than minSize will be ignored unless ForceMinSize is true MinSize int // ForceMinSize when true will force to return a favicon even if its size is // smaller than MinSize ForceMinSize bool Service Service }
Click to show internal directories.
Click to hide internal directories.