downloader

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 11 Imported by: 0

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

func (h *HTTPDownloader) Download(ctx context.Context, uri string, destPath string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL