Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultBlockSize = 65536
Variables ¶
View Source
var DefaultDownloadManager = NewDownloadManager()
Functions ¶
This section is empty.
Types ¶
type DownloadManager ¶
type DownloadManager struct {
// MaxConcurrent is the maximum number of concurrent downloads.
// changing it might not be effective immediately. Default is 10
MaxConcurrent int
// Client is the http client used to access urls to be downloaded
Client *http.Client
// TmpDir is where temporary files are created, and by default will be os.TempDir()
TmpDir string
// MaxDataJump is the maximum data that can be read & dropped when seeking forward
// default is 128k
MaxDataJump int64
// contains filtered or unexported fields
}
func NewDownloadManager ¶
func NewDownloadManager() *DownloadManager
func (*DownloadManager) Open ¶
func (dlm *DownloadManager) Open(u string) (*File, error)
Open a given URL and return a file pointer that will run partial downloads when reads are needed. Downloaded data will be stored in the system temp directory, and will be removed at the end if download is incomplete.
type File ¶
type File struct {
// contains filtered or unexported fields
}
func Open ¶
Open a given URL and return a file pointer that will run partial downloads when reads are needed. Downloaded data will be stored in the system temp directory, and will be removed at the end if download is incomplete.
func (*File) Close ¶
Close will close the file and make sure data is synced on the disk if the download is still partial.
Click to show internal directories.
Click to hide internal directories.