downloader

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aria2Input

type Aria2Input struct {
	// The file name of the downloaded file
	Out string `json:"out"`
	// For a simple download, only add headers
	Header []string `json:"header"`
}

Aria2Input is options for `aria2.addUri` https://aria2.github.io/manual/en/html/aria2c.html#id3

type Aria2RPCData

type Aria2RPCData struct {
	// More info about RPC interface please refer to
	// https://aria2.github.io/manual/en/html/aria2c.html#rpc-interface
	JSONRPC string `json:"jsonrpc"`
	ID      string `json:"id"`
	// For a simple download, only inplemented `addUri`
	Method string `json:"method"`
	// secret, uris, options
	Params [3]interface{} `json:"params"`
}

Aria2RPCData defines the data structure of json RPC 2.0 info for Aria2

type Downloader

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

Downloader is the default downloader.

func New

func New(option Options) *Downloader

New returns a new Downloader implementation.

func (*Downloader) Download

func (downloader *Downloader) Download(data *types.Data) error

Download download urls

func (*Downloader) GetInfo

func (downloader *Downloader) GetInfo(d *types.Data) (Site, Title, Type string, Size int64, FileNameLength int, stream *types.Stream)

func (*Downloader) GetSize

func (downloader *Downloader) GetSize(part *types.Part, refer, fileName string) (savedSize int64, err error)

type FilePartMeta

type FilePartMeta struct {
	Index float32
	Start int64
	End   int64
	Cur   int64
}

FilePartMeta defines the data structure of file meta info.

type Options

type Options struct {
	InfoOnly       bool
	Silent         bool
	Stream         string
	Refer          string
	OutputPath     string
	OutputName     string
	FileNameLength int
	Caption        bool

	MultiThread  bool
	ThreadNumber int
	RetryTimes   int
	ChunkSizeMB  int
	// Aria2
	UseAria2RPC bool
	Aria2Token  string
	Aria2Method string
	Aria2Addr   string
}

Options defines options used in downloading.

Jump to

Keyboard shortcuts

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