Documentation ¶
Overview ¶
Package downloader provides a simple file downlaoder
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileDownloader ¶
type FileDownloader struct { SaveDir string // path of the directory to save the downloaded file DefaultHeader http.Header // Default header to applied to the download request Client *http.Client // HTTP client to use, default is http DefaultClient ProxyReader ProxyReader }
FileDownloader is a file downloader
func (*FileDownloader) Download ¶
func (d *FileDownloader) Download(url string) (dest string, size int64, err error)
Download downloads a file from a URL and returns the path and size of the downloaded file
func (*FileDownloader) DownloadTo ¶
func (d *FileDownloader) DownloadTo(url string, outputName string) (dest string, size int64, err error)
DownloadTo downloads a file from a URL to the file with the specified name in the download directory
func (*FileDownloader) RemoveDir ¶
func (d *FileDownloader) RemoveDir() error
RemoveDir removes the download directory
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar is an implementation of ProxyReader that displays a process bar during file downloading.
func NewProgressBar ¶
func NewProgressBar(out io.Writer) *ProgressBar
func (*ProgressBar) Finish ¶
func (p *ProgressBar) Finish()
Click to show internal directories.
Click to hide internal directories.