download

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInsecure

func GetInsecure(uri, dir string, fetcher Fetcher) error

GetInsecure downloads a zip and extracts it to the dir.

func GetWithSha256

func GetWithSha256(uri, dir, sha string, fetcher Fetcher) error

GetWithSha256 downloads a zip, verifies it and extracts it to the dir.

Types

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.

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 againtst it's correctness.

func NewSha256Verifier

func NewSha256Verifier(hash string) Verifier

NewSha256Verifier creates a Verifier that tests against the given hash.

func NewTrueVerifier

func NewTrueVerifier() Verifier

NewTrueVerifier returns a Verifier that always verifies to true.

Jump to

Keyboard shortcuts

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