httpclient

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const FlushDiskSize = 1024 * 1024

Variables

This section is empty.

Functions

func CheckMultipart

func CheckMultipart(urls string) (bool, error)

func GetPipeList

func GetPipeList(pipeNames ...string) []func(context.Context, *Downloader) error

func GetSize

func GetSize(urls string) (int64, error)

func PipeList

func PipeList() map[string]*Pipe

func PipeRegister

func PipeRegister(pipe *Pipe)

func PipeUnregister

func PipeUnregister(ident string)

Types

type DefaultDownloader

type DefaultDownloader struct {
	// contains filtered or unexported fields
}

func CreateDefaultDownloader

func CreateDefaultDownloader(url string, file *iotools.SafeFile) *DefaultDownloader

func (*DefaultDownloader) AfterStop

func (pd *DefaultDownloader) AfterStop() error

func (*DefaultDownloader) BeforeRun

func (pd *DefaultDownloader) BeforeRun(context.Context) error

func (*DefaultDownloader) DoWork

func (pd *DefaultDownloader) DoWork(ctx context.Context) (bool, error)

func (DefaultDownloader) GetProgress

func (pd DefaultDownloader) GetProgress() model.DownloadProgress

func (*DefaultDownloader) IsPartialDownload

func (pd *DefaultDownloader) IsPartialDownload() bool

func (*DefaultDownloader) ResetProgress

func (pd *DefaultDownloader) ResetProgress()

type Downloader

type Downloader struct {
	Fi model.FileInfo
	// contains filtered or unexported fields
}

func CreateDownloader

func CreateDownloader(url string, fp string, seg int64, getDown func() string, pipeNames ...string) (dl *Downloader, err error)

func RestoreDownloader

func RestoreDownloader(url string, fp string, dp []model.DownloadProgress, getDown func() string, pipeNames ...string) (dl *Downloader, err error)

func (*Downloader) GetProgress

func (dl *Downloader) GetProgress() []model.DownloadProgress

func (*Downloader) ProgressGetter

func (dl *Downloader) ProgressGetter() func() (downloaded int64, total int64, percentProgress int64, speed int64)

func (*Downloader) SafeFile

func (dl *Downloader) SafeFile() *iotools.SafeFile

func (*Downloader) SetProgressGetter

func (dl *Downloader) SetProgressGetter(f func() (downloaded int64, total int64, percentProgress int64, speed int64)) *Downloader

func (*Downloader) StartAll

func (dl *Downloader) StartAll() []error

func (*Downloader) State

func (dl *Downloader) State() monitor.State

func (*Downloader) StopAll

func (dl *Downloader) StopAll() []error

type PartialDownloader

type PartialDownloader struct {
	// contains filtered or unexported fields
}

func CreatePartialDownloader

func CreatePartialDownloader(url string, file *iotools.SafeFile, from int64, pos int64, to int64) *PartialDownloader

func (*PartialDownloader) AfterStop

func (pd *PartialDownloader) AfterStop() error

func (*PartialDownloader) AfterStopDownload

func (pd *PartialDownloader) AfterStopDownload() error

func (*PartialDownloader) BeforeDownload

func (pd *PartialDownloader) BeforeDownload(ctx context.Context) error

func (*PartialDownloader) BeforeRun

func (pd *PartialDownloader) BeforeRun(ctx context.Context) error

func (*PartialDownloader) DoWork

func (pd *PartialDownloader) DoWork(ctx context.Context) (bool, error)

func (*PartialDownloader) DownloadSergment

func (pd *PartialDownloader) DownloadSergment(ctx context.Context) (bool, error)

func (PartialDownloader) GetProgress

func (pd PartialDownloader) GetProgress() model.DownloadProgress

func (*PartialDownloader) IsPartialDownload

func (pd *PartialDownloader) IsPartialDownload() bool

func (*PartialDownloader) ResetProgress

func (pd *PartialDownloader) ResetProgress()

type Pipe

type Pipe struct {
	Ident      string
	Label      string
	Extensions []string
	// contains filtered or unexported fields
}

func NewPipe

func NewPipe(ident string, label string, f PipeFunc, extensions ...string) *Pipe

func PipeGet

func PipeGet(ident string) *Pipe

func (*Pipe) Function

func (p *Pipe) Function() PipeFunc

func (*Pipe) SetFunction

func (p *Pipe) SetFunction(f PipeFunc) *Pipe

type PipeFunc

type PipeFunc func(context.Context, *Downloader) error

Jump to

Keyboard shortcuts

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