downloader

package
v0.0.0-...-732aecd Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2014 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Download

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

Download can download a file from the network.

func New

func New(url, dir string, hostnameVerification utils.SSLHostnameVerification) *Download

New returns a new Download instance downloading from the given URL to the given directory. If dir is empty, it defaults to os.TempDir(). If disableSSLHostnameVerification is true then a non- validating http client will be used.

func (*Download) Done

func (d *Download) Done() <-chan Status

Done returns a channel that receives a status when the download has completed. It is the receiver's responsibility to close and remove the received file.

func (*Download) Stop

func (d *Download) Stop()

Stop stops any download that's in progress.

type Status

type Status struct {
	// File holds the downloaded data on success.
	File *os.File
	// Err describes any error encountered while downloading.
	Err error
}

Status represents the status of a completed download.

Jump to

Keyboard shortcuts

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