Documentation ¶
Overview ¶
Package pluto provides a way to download files at high speeds by using http ranged requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
// ErrOverflow is when server sends more data than what was requested
ErrOverflow = "error: Server sent extra bytes"
)
Functions ¶
func Download ¶
Download takes Config struct then downloads the file by dividing it into given number of parts and downloading all parts concurrently. If any error occurs in the downloading stage of any part, It'll check if the the program can recover from error by retrying download And if an error occurs which the program can not recover from, it'll return that error
Types ¶
type Config ¶
type Config struct { Connections uint Verbose bool Headers []string Writer io.WriterAt Meta *FileMeta StatsChan chan *Stats // contains filtered or unexported fields }
Config contains all the details that Download needs. Connections is the number of connections to use to download a file Verbose is to enable verbose mode. Writer is the place where downloaded data is written. Headers is any header that you may need to send to download the file. StatsChan is a channel to which Stats are sent, It can be nil or a channel that can hold data of type *()