Versions in this module Expand all Collapse all v3 v3.0.2 May 14, 2024 Changes in this version + var DefaultClient = NewClient() + var ErrBadChecksum = errors.New("checksum mismatch") + var ErrBadLength = errors.New("bad content length") + var ErrFileExists = errors.New("file exists") + var ErrNoFilename = errors.New("no filename could be determined") + var ErrNoTimestamp = errors.New("no timestamp could be determined for the remote file") + func GetBatch(workers int, dst string, urlStrs ...string) (<-chan *Response, error) + func IsStatusCodeError(err error) bool + type Client struct + BufferSize int + Cookies []*http.Cookie + HTTPClient *http.Client + UserAgent string + func NewClient() *Client + func (c *Client) Do(req *Request) *Response + func (c *Client) DoBatch(workers int, requests ...*Request) <-chan *Response + func (c *Client) DoChannel(reqch <-chan *Request, respch chan<- *Response) + func (c *Client) SetCookies(cookies []*http.Cookie) + type HTTPClient interface + Do func(req *http.Request) (*http.Response, error) + type Hook func(*Response) error + type RateLimiter interface + WaitN func(ctx context.Context, n int) (err error) + type Request struct + AfterCopy Hook + BeforeCopy Hook + BufferSize int + Filename string + HTTPRequest *http.Request + IgnoreBadStatusCodes bool + IgnoreRemoteTime bool + Label string + NoCreateDirectories bool + NoResume bool + NoStore bool + RateLimiter RateLimiter + Size int64 + SkipExisting bool + Tag interface{} + func NewRequest(dst, urlStr string) (*Request, error) + func (r *Request) Context() context.Context + func (r *Request) SetChecksum(h hash.Hash, sum []byte, deleteOnError bool) + func (r *Request) URL() *url.URL + func (r *Request) WithContext(ctx context.Context) *Request + type Response struct + CanResume bool + DidResume bool + Done chan struct{} + End time.Time + Filename string + HTTPResponse *http.Response + Request *Request + Start time.Time + func Get(dst, urlStr string) (*Response, error) + func (c *Response) Bytes() ([]byte, error) + func (c *Response) BytesComplete() int64 + func (c *Response) BytesPerSecond() float64 + func (c *Response) Cancel() error + func (c *Response) Duration() time.Duration + func (c *Response) ETA() time.Time + func (c *Response) Err() error + func (c *Response) IsComplete() bool + func (c *Response) Open() (io.ReadCloser, error) + func (c *Response) Progress() float64 + func (c *Response) Size() int64 + func (c *Response) Wait() + type StatusCodeError int + func (err StatusCodeError) Error() string