Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader interface {
// Download fetches a remote file and writes it to the specified destination path.
Download(ctx context.Context, destination, source string) error
// DownloadWithFallback tries to download from the primary source first,
// then falls back to alternative sources in order if the primary fails.
DownloadWithFallback(ctx context.Context, destination, source string, fallbackSources ...string) error
// Get returns a streaming reader for the remote content without buffering the entire response in memory.
// Caller is responsible for closing the returned io.ReadCloser.
Get(ctx context.Context, source string) (io.ReadCloser, error)
}
Downloader provides methods for downloading files from remote URLs with automatic retries.
func NewDownloader ¶
func NewDownloader(logger log.Logger) Downloader
NewDownloader creates a new Downloader with automatic retry support.
func NewDownloaderWithClient ¶
func NewDownloaderWithClient(client *http.Client, logger log.Logger) Downloader
NewDownloaderWithClient creates a new Downloader with a custom HTTP client. Use this for advanced scenarios where you need custom client configuration. For most use cases, prefer NewDownloader which includes retry support by default.
Click to show internal directories.
Click to hide internal directories.