urldownloader

package
v1.12.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PieceResult

type PieceResult struct {
	Downloader *URLDownloader
	Buffer     bufferpool.Buffer
	Index      uint32
	Error      error
	Done       bool // URL downloader finished downloading all requested pieces
}

PieceResult wraps the downloaded piece data.

type URLDownloader

type URLDownloader struct {
	URL        string
	Begin, End uint32 // piece index
	// contains filtered or unexported fields
}

URLDownloader downloads files from a HTTP source.

func New

func New(source string, begin, end uint32, b *ratelimit.Bucket) *URLDownloader

New returns a new URLDownloader for the given source and piece range.

func (*URLDownloader) Close

func (d *URLDownloader) Close()

Close the URLDownloader.

func (*URLDownloader) ReadCurrent added in v0.8.0

func (d *URLDownloader) ReadCurrent() uint32

ReadCurrent returns the index of piece that is currently being downloaded.

func (*URLDownloader) Run

func (d *URLDownloader) Run(client *http.Client, pieces []piece.Piece, multifile bool, resultC chan *PieceResult, pool *bufferpool.Pool, readTimeout time.Duration)

Run the URLDownloader and download pieces.

func (*URLDownloader) String added in v0.8.0

func (d *URLDownloader) String() string

String returns the URL being downloaded.

func (*URLDownloader) UpdateEnd added in v0.8.0

func (d *URLDownloader) UpdateEnd(value uint32)

UpdateEnd updates the end index of the piece range being downloaded.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL