Documentation
¶
Index ¶
- Constants
- Variables
- func MatchDownloadWitchFilter(download Download, filter string) bool
- func PrintDownload(output io.Writer, d Download, msgWidth int)
- func PrintDownloadListHeader(output io.Writer, msgWidth int)
- func PrintStatus(output io.Writer, clientInstance Client, s Status)
- func Register(regInfo *RegInfo)
- func Sep(client Client) string
- type BaseDownloadTask
- type Client
- type Download
- type DownloadTask
- type Downloads
- type RegInfo
- type Status
Constants ¶
View Source
const DOWNLOAD_LIST_DEFAULT_MSG_WIDTH = 40
View Source
const DOWNLOAD_LIST_FORMAT = "%-16s %-12s %-7s %-*s %-s\n"
"Id", "Status", "Size", msgWidth, "Msg", "Path"
Variables ¶
View Source
var (
ErrFileExists = fmt.Errorf("local file exists")
)
Functions ¶
func PrintDownloadListHeader ¶
Types ¶
type BaseDownloadTask ¶
func (*BaseDownloadTask) GetFilename ¶
func (b *BaseDownloadTask) GetFilename() string
func (*BaseDownloadTask) GetPaused ¶
func (b *BaseDownloadTask) GetPaused() bool
func (*BaseDownloadTask) GetSavePath ¶
func (b *BaseDownloadTask) GetSavePath() string
func (*BaseDownloadTask) GetUrl ¶
func (b *BaseDownloadTask) GetUrl() string
type Client ¶
type Client interface {
GetStatus() (Status, error)
GetConfig() *config.ClientConfig
Add(DownloadTask) (id string, err error) // Return created download id
Get(id string) (download Download, err error)
Delete(id string) error
Pause(id string) error
Resume(id string) error // Note it will throw an error if task state is "error"
GetAll() (Downloads, error)
ChangeUrl(id string, url string) error
}
Modeled after aria2 APIs. Notable, there is no way to resume an error task, the only choice is to re-create a new one. Currently, only http / ftp tasks is supported (a task has only one (1) file)
func CreateClient ¶
func CreateClientInternal ¶
type DownloadTask ¶
Click to show internal directories.
Click to hide internal directories.