Documentation ¶
Index ¶
- Variables
- func AddToQueue(url string) error
- func GetIDMPath() string
- func SetIDMPath(path string) error
- func StartMainQueue() error
- func VerifyIDM() (bool, error)
- type ApplicationsListError
- type Download
- func (d *Download) AddToQueue() error
- func (d *Download) GetFullPath() (string, error)
- func (d *Download) HangUpAfterFinish() *Download
- func (d *Download) QuitAfterFinish() *Download
- func (d *Download) SetFileName(name string) *Download
- func (d *Download) SetFilePath(path string) *Download
- func (d *Download) Silent() *Download
- func (d *Download) Start() error
- func (d *Download) VerifyDownload(timeout time.Duration) error
- type URLHeaderError
Constants ¶
This section is empty.
Variables ¶
var DownloadFilePathNotProvidedError = errors.New("no file path is provided for download. (necessary for download verification)")
DownloadFilePathNotProvidedError represents the error when no file path is provided but one is required
var FileNameDetectionError = errors.New("file name is not specified and it doesn't exist on url header either")
FileNameDetectionError represents the error when program can't find file name in header and no local file name is provided
var FileNameHeaderError = errors.New("file name is not available in url headers")
FileNameHeaderError represents the error when the file name isn't present in url headers
var IDMNotInstalledError = errors.New("idm is not installed")
IDMNotInstalledError represents the error when idm is not installed
var IDMPathError = errors.New("failed to verify the given idm path")
IDMPathError represents the error when the given IDM path doesn't exist
var InValidURLError = errors.New("provided url is not a valid url")
InValidURLError represents the error for when the provided url is not a valid url
var URLStatusCodeError = errors.New("url didn't return status code 200")
URLStatusCodeError represents the error when url didn't return a status code 200
var WaitForDownloadTimeOutError = errors.New("file didn't appear in specified duration")
WaitForDownloadTimeOutError represents the error when time out duration is reached while waiting for a file download to be complete
Functions ¶
func AddToQueue ¶
AddToQueue adds the given url to IDM queue File download won't be started
func GetIDMPath ¶
func GetIDMPath() string
GetIDMPath returns the IDM installation path if idm is installed Returns empty string if idm isn't installed or failed to get the applications list Call VerifyIDM first if you're not sure if IDM is installed
func SetIDMPath ¶
Types ¶
type ApplicationsListError ¶
type ApplicationsListError struct {
// contains filtered or unexported fields
}
ApplicationsListError represents the error when program can't list the installed programs NOTE: only windows
func (*ApplicationsListError) Error ¶
func (e *ApplicationsListError) Error() string
type Download ¶
type Download struct { URL string // /p Path string // /f FileName string // /q Quit bool // /h HangUp bool // /n SilentMode bool // Used to extract file size and file name URLHeader *http.Response }
Download represents the IDM parameters and data needed to verify download completion
func NewDownload ¶
NewDownload creates a new download
func (*Download) AddToQueue ¶
AddToQueue adds specified file to download queue, but don't start downloading Calling Start() after calling this method won't download the queued download (starts a new download in IDM).
func (*Download) GetFullPath ¶
GetFullPath returns the full path of the file File path must be provided using SetFilePath method If file name hasn't been set, it will try to get it from url header (returns error if not available in header)
func (*Download) HangUpAfterFinish ¶
HangUpAfterFinish sets the /h param IDM will hang up your connection after the successful downloading
func (*Download) QuitAfterFinish ¶
QuitAfterFinish sets the /q param IDM will exit after the successful downloading. This parameter works only for the first copy
func (*Download) SetFileName ¶
SetFilePath sets the /f param Defines local file name to save the file
func (*Download) SetFilePath ¶
SetFilePath sets the /p param Defines the local path where to save the file
type URLHeaderError ¶
type URLHeaderError struct {
// contains filtered or unexported fields
}
URLHeaderError represents the error when something goes wrong while fetching the url header
func (*URLHeaderError) Error ¶
func (e *URLHeaderError) Error() string