package downloader
import (
"github.com/gotd/td/bin"
"github.com/gotd/td/tg"
)
type Downloader struct {
partSize int
pool *bin .Pool
allowCDN *bool
retryHandler RetryHandler
}
const defaultPartSize = 512 * 1024
func NewDownloader () *Downloader {
return new (Downloader ).WithPartSize (defaultPartSize )
}
func (d *Downloader ) WithPartSize (partSize int ) *Downloader {
d .partSize = partSize
d .pool = bin .NewPool (partSize )
return d
}
func (d *Downloader ) WithAllowCDN (allow bool ) *Downloader {
d .allowCDN = &allow
return d
}
func (d *Downloader ) WithRetryHandler (handler RetryHandler ) *Downloader {
d .retryHandler = handler
return d
}
func (d *Downloader ) Download (rpc Client , location tg .InputFileLocationClass ) *Builder {
return newBuilder (d , master {
client : rpc ,
precise : true ,
allowCDN : false ,
retryHandler : d .retryHandler ,
location : location ,
})
}
func (d *Downloader ) Web (rpc Client , location tg .InputWebFileLocationClass ) *Builder {
return newBuilder (d , web {
client : rpc ,
retryHandler : d .retryHandler ,
location : location ,
})
}
The pages are generated with Golds v0.8.4 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .