Documentation
¶
Index ¶
- func Get(url string, parameters ...RequestParam) (*http.Response, error)
- func GetBuffer(url string, parameters ...RequestParam) (*bytes.Buffer, error)
- func GetBytes(url string, parameters ...RequestParam) ([]byte, error)
- func GetString(url string, parameters ...RequestParam) (string, error)
- type Param
- type Progress
- type RequestParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
func Get(url string, parameters ...RequestParam) (*http.Response, error)
Get send a GET request to server and return response or error
func GetBuffer ¶ added in v0.2.0
func GetBuffer(url string, parameters ...RequestParam) (*bytes.Buffer, error)
GetBuffer send a GET request to server and return response buffer or error
Types ¶
type Param ¶
type Param struct {
URL string
Refer string
Retry int
RetryInterval time.Duration
LogChannel chan<- string
ProgressChannel chan<- *Progress
ProgressInterval time.Duration
}
Param download parameters
func (Param) SendProgress ¶ added in v0.2.0
SendProgress send progress
type Progress ¶ added in v0.2.0
type Progress struct {
Total int64
Completed int64
Speed int64
Elapsed time.Duration
Remain time.Duration
}
Progress download progress
type RequestParam ¶
type RequestParam interface {
// contains filtered or unexported methods
}
RequestParam defines download parameters
func OnProgress ¶ added in v0.2.0
func OnProgress(progressChannel chan<- *Progress, interval time.Duration) RequestParam
OnProgress send download progress
Click to show internal directories.
Click to hide internal directories.