Documentation ¶
Index ¶
- Constants
- func RandString(n int) string
- func ResponseCodeNotSuccessFullError(statusCode int) error
- type AddDownloadOpts
- type DownloadEvent
- type DownloadPart
- func (d *DownloadPart) CompletedLength() int64
- func (d *DownloadPart) Download() error
- func (d *DownloadPart) HandleResponse(resp *http.Response) error
- func (d *DownloadPart) HandleResponseWriter(resp *http.Response) error
- func (d *DownloadPart) TotalLength() int64
- func (d *DownloadPart) Write(p []byte) (int, error)
- type HTTPDownload
- func (h *HTTPDownload) CancelDownload()
- func (h *HTTPDownload) CompletedLength() int64
- func (h *HTTPDownload) GetFailureError() error
- func (h *HTTPDownload) GetFileHandle() *os.File
- func (h *HTTPDownload) Gid() string
- func (h *HTTPDownload) Init()
- func (h *HTTPDownload) IsCancelled() bool
- func (h *HTTPDownload) IsCompleted() bool
- func (h *HTTPDownload) IsFailed() bool
- func (h *HTTPDownload) Name() string
- func (h *HTTPDownload) Speed() int64
- func (h *HTTPDownload) SpeedObserver()
- func (h *HTTPDownload) StartDownload()
- func (h *HTTPDownload) TotalLength() int64
- type HTTPDownloadListener
- type HTTPDownloader
- func (h *HTTPDownloader) AddDownload(url string, opts *AddDownloadOpts) (*HTTPDownload, error)
- func (h *HTTPDownloader) AddListener(listener HTTPDownloadListener)
- func (h *HTTPDownloader) GetURLProperties(url string) (*URLProperties, error)
- func (h *HTTPDownloader) HeaderSupportsByteRange(header http.Header) bool
- func (h *HTTPDownloader) ListenForEvents(download *HTTPDownload)
- func (h *HTTPDownloader) NotifyListeners(event DownloadEvent, download *HTTPDownload)
- func (h *HTTPDownloader) SniffFilename(url string, header http.Header) string
- type URLProperties
Constants ¶
View Source
const ( OnDownloadStartEvent = 0 OnDownloadCompleteEvent = 1 OnDownloadStopEvent = 2 )
Variables ¶
This section is empty.
Functions ¶
func RandString ¶
Types ¶
type AddDownloadOpts ¶
type DownloadEvent ¶
type DownloadEvent int
type DownloadPart ¶
func (*DownloadPart) CompletedLength ¶
func (d *DownloadPart) CompletedLength() int64
func (*DownloadPart) Download ¶
func (d *DownloadPart) Download() error
func (*DownloadPart) HandleResponse ¶
func (d *DownloadPart) HandleResponse(resp *http.Response) error
func (*DownloadPart) HandleResponseWriter ¶
func (d *DownloadPart) HandleResponseWriter(resp *http.Response) error
func (*DownloadPart) TotalLength ¶
func (d *DownloadPart) TotalLength() int64
type HTTPDownload ¶
type HTTPDownload struct {
// contains filtered or unexported fields
}
func (*HTTPDownload) CancelDownload ¶
func (h *HTTPDownload) CancelDownload()
func (*HTTPDownload) CompletedLength ¶
func (h *HTTPDownload) CompletedLength() int64
func (*HTTPDownload) GetFailureError ¶
func (h *HTTPDownload) GetFailureError() error
func (*HTTPDownload) GetFileHandle ¶
func (h *HTTPDownload) GetFileHandle() *os.File
func (*HTTPDownload) Gid ¶
func (h *HTTPDownload) Gid() string
func (*HTTPDownload) Init ¶
func (h *HTTPDownload) Init()
func (*HTTPDownload) IsCancelled ¶
func (h *HTTPDownload) IsCancelled() bool
func (*HTTPDownload) IsCompleted ¶
func (h *HTTPDownload) IsCompleted() bool
func (*HTTPDownload) IsFailed ¶
func (h *HTTPDownload) IsFailed() bool
func (*HTTPDownload) Name ¶
func (h *HTTPDownload) Name() string
func (*HTTPDownload) Speed ¶
func (h *HTTPDownload) Speed() int64
func (*HTTPDownload) SpeedObserver ¶
func (h *HTTPDownload) SpeedObserver()
func (*HTTPDownload) StartDownload ¶
func (h *HTTPDownload) StartDownload()
func (*HTTPDownload) TotalLength ¶
func (h *HTTPDownload) TotalLength() int64
type HTTPDownloadListener ¶
type HTTPDownloadListener interface { OnDownloadStart(*HTTPDownload) OnDownloadComplete(*HTTPDownload) OnDownloadStop(*HTTPDownload) }
type HTTPDownloader ¶
type HTTPDownloader struct {
// contains filtered or unexported fields
}
func NewHTTPDownloader ¶
func NewHTTPDownloader(client *http.Client) *HTTPDownloader
func (*HTTPDownloader) AddDownload ¶
func (h *HTTPDownloader) AddDownload(url string, opts *AddDownloadOpts) (*HTTPDownload, error)
func (*HTTPDownloader) AddListener ¶
func (h *HTTPDownloader) AddListener(listener HTTPDownloadListener)
func (*HTTPDownloader) GetURLProperties ¶
func (h *HTTPDownloader) GetURLProperties(url string) (*URLProperties, error)
func (*HTTPDownloader) HeaderSupportsByteRange ¶
func (h *HTTPDownloader) HeaderSupportsByteRange(header http.Header) bool
func (*HTTPDownloader) ListenForEvents ¶
func (h *HTTPDownloader) ListenForEvents(download *HTTPDownload)
func (*HTTPDownloader) NotifyListeners ¶
func (h *HTTPDownloader) NotifyListeners(event DownloadEvent, download *HTTPDownload)
func (*HTTPDownloader) SniffFilename ¶
func (h *HTTPDownloader) SniffFilename(url string, header http.Header) string
Click to show internal directories.
Click to hide internal directories.