httpdownloader

package
v0.0.0-...-919b350 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPDownloader

type HTTPDownloader struct {
	// contains filtered or unexported fields
}

HTTPDownloader downloads a file from an HTTP server.

func NewHTTPDownloader

func NewHTTPDownloader(client *http.Client, clientTimeOut time.Duration, maxFileSize int64) *HTTPDownloader

NewHTTPDownloader instantiates a new HTTPDownloader.

Requests will be time bound by clientTimeOut. Files bigger than maxFileSize will be rejected.

func (*HTTPDownloader) Download

func (d *HTTPDownloader) Download(ctx context.Context, url string) (io.ReadCloser, error)

Download initiates a time constrained HTTP GET request, validates Content-Length and returns response body io.ReadCloser.

Jump to

Keyboard shortcuts

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