download

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2021 License: GPL-3.0 Imports: 17 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 struct {
	// contains filtered or unexported fields
}

Downloader is responsible for fetching, verifying and extracting a binary.

func NewDownloader

func NewDownloader(v Verifier, f Fetcher) Downloader

NewDownloader builds a new Downloader.

func (Downloader) Get

func (d Downloader) Get(uri, dst string) error

Get pulls the uri and verifies it. On success, the download gets extracted into dst.

type Fetcher

type Fetcher interface {
	// Get gets the file and returns an stream to read the file.
	Get(uri string) (io.ReadCloser, error)
}

Fetcher is used to get files from a URI.

func NewFileFetcher

func NewFileFetcher(fs afero.Fs, path string) Fetcher

NewFileFetcher returns a local file reader.

type HTTPFetcher

type HTTPFetcher struct{}

HTTPFetcher is used to get a file from a http:// or https:// schema path.

func (HTTPFetcher) Get

func (HTTPFetcher) Get(uri string) (io.ReadCloser, error)

Get gets the file and returns an stream to read the file.

type Verifier

type Verifier interface {
	io.Writer
	Verify() error
}

Verifier can check a reader against it's correctness.

func NewSha256Verifier

func NewSha256Verifier(hashed string) Verifier

NewSha256Verifier creates a Verifier that tests against the given hash.

Jump to

Keyboard shortcuts

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