download

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFile

func DownloadFile(fs afero.Fs, ctx context.Context, url, filePath string, logger *logging.Logger, useLatest bool) error

DownloadFile downloads a file from the specified URL and saves it to the given path. If useLatest is true, it overwrites the destination file regardless of its existence.

func DownloadFiles

func DownloadFiles(fs afero.Fs, ctx context.Context, downloadDir string, urls []string, logger *logging.Logger, useLatest bool) error

Given a list of URLs, download it to a target.

func MakeGetRequest added in v0.1.5

func MakeGetRequest(ctx context.Context, uri string) (*http.Response, error)

Types

type WriteCounter

type WriteCounter struct {
	Total         uint64
	LocalFilePath string
	DownloadURL   string
}

WriteCounter tracks the total number of bytes written and prints download progress.

func (*WriteCounter) PrintProgress

func (wc *WriteCounter) PrintProgress()

PrintProgress displays the download progress in the terminal.

func (*WriteCounter) Write

func (wc *WriteCounter) Write(p []byte) (int, error)

Write implements the io.Writer interface and updates the total byte count.

Jump to

Keyboard shortcuts

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