Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get downloads a url and returns the body Timeout is 10 seconds Will only write to disk if http status code is 2XX
func IfNeeded ¶
IfNeeded takes the same values as Download plus a hash as a string It will check if the file already exists, by comparing the hash If the hash does not match, it will attempt to download the file Once downloaded it will attempt to verify the hash again Cancelling ctx aborts a download in progress, and IfNeeded returns false. progress, when not nil, follows a download whose length the server sent.
func SetConfig ¶
func SetConfig(cfg config.Configuration)
SetConfig accepts a configuration struct that all functions in the `download` package will use
Types ¶
type Progress ¶ added in v1.11.0
type Progress func(percent int)
Progress receives a download's whole percentage each time it changes. It is called only when the server sent the body's length.
type StatusError ¶ added in v1.11.0
StatusError is a download the server answered with a status other than 200. errors.As it to tell a missing file (404) from other failures.
func (*StatusError) Error ¶ added in v1.11.0
func (e *StatusError) Error() string