Documentation
¶
Overview ¶
Package download fetches remote files used by this program and the website.
Index ¶
- Constants
- func CheckTime(t time.Duration) time.Duration
- func Get(url string, timeout time.Duration) ([]byte, int, error)
- func GetSave(w io.Writer, name, url string) (http.Header, error)
- func PingFile(link string, timeout time.Duration) (code int, name string, size string, err error)
- func PingHead(url string, timeout time.Duration) (*http.Response, error)
- func StatusColor(code int, status string) string
- type Request
Constants ¶
View Source
const ( // UserAgent is the value of User-Agent request HEADER // that lets servers identify this application. UserAgent = "defacto2 cli" // RFC5322 is a HTTP-date value. RFC5322 = "Mon, 2 Jan 2006 15:04:05 MST" // DownloadPrefix header filename attachment. DownloadPrefix = "attachment; filename=" ContentDisposition = "Content-Disposition" ContentLength = "Content-Length" )
Variables ¶
This section is empty.
Functions ¶
func CheckTime ¶
CheckTime creates a valid time duration for use with http.Client.Timeout. The t value can be 0 or a number of seconds.
func PingFile ¶ added in v1.10.0
func PingFile(link string, timeout time.Duration) ( code int, name string, size string, err error, )
PingFile connects to a URL file down and returns its status code, filename and file size.
func PingHead ¶ added in v1.10.0
PingHead connects to a URL and returns its HTTP status code and status text.
func StatusColor ¶
StatusColor colours the HTTP status based on its severity.
Types ¶
Click to show internal directories.
Click to hide internal directories.