download

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ADNameFromHeader

func ADNameFromHeader(prefix string) func(*Download)

Types

type Download

type Download struct {
	Client *http.Client
	Addr   *url.URL

	AllowOverride bool
	Err           error
	AfterDownload func(*Download)
	// contains filtered or unexported fields
}

func (*Download) Dir

func (dl *Download) Dir() string

func (*Download) Exists

func (dl *Download) Exists() (bool, error)

Exists returns true if there already is a file named the same as specified in the Download struct. Panics if the field "dir" or "file" is zero-valued.

func (*Download) File

func (dl *Download) File() string

func (*Download) NameFromHeader

func (dl *Download) NameFromHeader() (string, error)

func (*Download) Path

func (dl *Download) Path() string

Path returns the absolute path to the (to be) downloaded file. Panics if the field "dir" or "file" is zero-valued.

func (*Download) Rename

func (dl *Download) Rename(name string) error

Rename changes the file name of a download. If the download already exists, it will be renamed on the file system.

func (*Download) SetDir

func (dl *Download) SetDir(dir string) error

SetDir sets the download directory. Panics if dir is not an absolute path.

func (*Download) SetFile

func (dl *Download) SetFile(name string)

type DownloadCounter

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

func NewDownloadCounter

func NewDownloadCounter() *DownloadCounter

func (*DownloadCounter) Count

func (dc *DownloadCounter) Count() uint64

type DownloadDispatcher

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

func NewDownloadDispatcher

func NewDownloadDispatcher(downloads int) *DownloadDispatcher

func (*DownloadDispatcher) ChooChoo

func (r *DownloadDispatcher) ChooChoo()

func (*DownloadDispatcher) Close

func (r *DownloadDispatcher) Close()

func (*DownloadDispatcher) Collect

func (r *DownloadDispatcher) Collect() *Download

func (*DownloadDispatcher) Dispatch

func (r *DownloadDispatcher) Dispatch(dl *Download)

type DownloadFailure

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

func (DownloadFailure) Error

func (e DownloadFailure) Error() string

type NoFilenameInContentDisposition

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

func (NoFilenameInContentDisposition) Error

type RenameError

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

RenameError is thrown if renaming a downloaded file fails.

func NewRenameError

func NewRenameError(name string, newname string, err error) RenameError

func (RenameError) Error

func (e RenameError) Error() string

func (RenameError) Unwrap

func (e RenameError) Unwrap() error

Jump to

Keyboard shortcuts

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