Documentation ¶
Overview ¶
Package adownload provides a simple download Manager for asynchronous download of a list of URLs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Download ¶
func Download(ctx context.Context, fsa fsadapter.FS, subdir string, urls []string, opts ...Option) error
Download downloads files given the list of urls to the subdirectory within the filesystem wrapped by fs adapter fsa. URLs must point to files, otherwise the behaviour is undefined. It does not support the recursive download.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the download manager.
func NewWithPath ¶
NewWithPath creates a download Manager which initialises a file system adapter over the ZIP file or Directory specified in zipOrDir. It must be closed with [Close] to ensure that all buffers are flushed to disk.
func (*Manager) Close ¶
Close closes the underlying filesystem adapter, if necessary. If the Manager wasn't initialised with NewWithPath then calling Close is noop.
type Option ¶
type Option func(m *Manager)
Option is the download manager option.
func IgnoreHTTPErrors ¶
IgnoreHTTPErrors allows to ignore HTTP errors (enabled by default)
func NumWorkers ¶
NumWorkers allows to set the number of goroutines that will download the files.
func WithClient ¶ added in v0.2.0
WithClient allows to specify a custom HTTP client to use.