Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader interface {
// Download downloads a file from the specified URI and saves it to the destination path.
Download(ctx context.Context, uri string, destPath string) error
// FetchStream initiates fetching the specified URI and returns it as an io.ReadCloser.
// The caller is responsible for closing the returned io.ReadCloser.
FetchStream(ctx context.Context, uri string) (io.ReadCloser, error)
}
Downloader defines an interface for downloading files from a given URI to a specified destination path.
type HTTPDownloader ¶
type HTTPDownloader struct {
// contains filtered or unexported fields
}
HTTPDownloader implements the Downloader interface. It uses the http module to download files.
func NewHTTPDownloader ¶
func NewHTTPDownloader( dryRunInfo opctx.DryRunnable, eventListener opctx.EventListener, fs opctx.FS, ) (*HTTPDownloader, error)
func (*HTTPDownloader) Download ¶
Downloads a file from the location specified by the URI, saving it to destPath.
func (*HTTPDownloader) FetchStream ¶
func (h *HTTPDownloader) FetchStream(ctx context.Context, uri string) (io.ReadCloser, error)
Downloads a file from the location specified by URI, returning it as an io.ReadCloser.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package downloader_test is a generated GoMock package.
|
Package downloader_test is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.