Documentation
¶
Overview ¶
Package download provides a library for interruptable, resumable download acceleration with automatic Accept-Ranges support.
see all examples https://github.com/joeybloggs/go-download/tree/master/examples
package main
import (
"log"
download "github.com/joeybloggs/go-download"
)
func main() {
// no options specified so will default to 10 concurrent download by default
f, err := download.Open("https://storage.googleapis.com/golang/go1.8.1.src.tar.gz", nil)
if err != nil {
log.Fatal(err)
}
defer f.Close()
// f implements io.Reader, write file somewhere or do some other sort of work with it
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canceled ¶
type Canceled struct {
// contains filtered or unexported fields
}
Canceled is the error containing the cancelled error information
type ConcurrencyFn ¶
ConcurrencyFn is the function used to determine the level of concurrency aka the number of goroutines to use. Default concurrency level is 10
if returned value is < 1 then the default value will be used
type DeadlineExceeded ¶
type DeadlineExceeded struct {
// contains filtered or unexported fields
}
DeadlineExceeded is the error containing the deadline exceeded error information
func (*DeadlineExceeded) Error ¶
func (e *DeadlineExceeded) Error() string
Error returns the DeadlineExceeded error string
type File ¶
File represents an open file descriptor to a downloaded file(s)
func OpenContext ¶
OpenContext downloads and opens the file(s) downloaded by the given url and is cancellable using the provided context. The context provided must be non-nil
type InvalidResponseCode ¶
type InvalidResponseCode struct {
// contains filtered or unexported fields
}
InvalidResponseCode is the error containing the invalid response code error information
func (*InvalidResponseCode) Error ¶
func (e *InvalidResponseCode) Error() string
Error returns the InvalidResponseCode error string
type Options ¶
type Options struct {
Concurrency ConcurrencyFn
Proxy ProxyFn
Client ClientFn
Request RequestFn
}
Options contains any specific configuration values for downloading/opening a file
Directories
¶
| Path | Synopsis |
|---|---|
|
_examples
|
|
|
basic
command
|
|
|
custom-concurrency
command
|
|
|
measure-progress
command
|
|
|
cmd
|
|
|
goget
command
|