Documentation ¶
Index ¶
- Variables
- func Download(dl *DownloadTask, timeout time.Duration) (err error)
- func DownloadWithContext(ctx context.Context, dl *DownloadTask) (err error)
- func Get(url string) (io.ReadCloser, error)
- func HTTPGet(url string) (body []byte, err error)
- func Headers(url string) (http.Header, error)
- func NewClient(baseURL string) *resty.Client
- func Size(url string) (int, error)
- type DownloadTask
- type DownloadTasks
- type GetDownload
- type HTTPClient
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// UserAgent UserAgent
UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
)
Functions ¶
func DownloadWithContext ¶ added in v1.1.6
func DownloadWithContext(ctx context.Context, dl *DownloadTask) (err error)
Types ¶
type DownloadTask ¶ added in v1.1.6
func NewDownloadTask ¶ added in v1.1.6
func NewDownloadTask(link, path string) *DownloadTask
type DownloadTasks ¶ added in v1.1.6
type DownloadTasks struct {
// contains filtered or unexported fields
}
func Batch ¶ added in v1.1.6
func Batch(tasks *DownloadTasks, concurrent int, eachTimeout time.Duration) *DownloadTasks
func NewDownloadTasks ¶ added in v1.1.6
func NewDownloadTasks() *DownloadTasks
func (*DownloadTasks) Add ¶ added in v1.1.6
func (d *DownloadTasks) Add(link, path string)
func (*DownloadTasks) ForEach ¶ added in v1.1.6
func (d *DownloadTasks) ForEach(f func(t *DownloadTask))
type GetDownload ¶ added in v1.1.6
type GetDownload struct { OnEachStart func(t *DownloadTask) OnEachStop func(t *DownloadTask) OnEachSkip func(t *DownloadTask) Header http.Header Client http.Client }
func Default ¶ added in v1.1.6
func Default() (g GetDownload)
func (*GetDownload) Batch ¶ added in v1.1.6
func (g *GetDownload) Batch(tasks *DownloadTasks, concurrent int, eachTimeout time.Duration) *DownloadTasks
func (*GetDownload) Download ¶ added in v1.1.6
func (g *GetDownload) Download(task *DownloadTask, timeout time.Duration) (err error)
func (*GetDownload) DownloadWithContext ¶ added in v1.1.6
func (g *GetDownload) DownloadWithContext(ctx context.Context, task *DownloadTask) (err error)
Click to show internal directories.
Click to hide internal directories.