godler

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DlerURL

type DlerURL struct {
	URL                   string        // 下载的url
	SavePath              string        // 保存路径带后缀
	OneThreading          bool          // 强制单线程
	ThreadingCount        int64         // 下载线程数 默认20
	ThreadingDownloadSize int64         // 每个区块下载的大小 默认1048576
	TimeOut               time.Duration //下载超时时间 默认 180 秒

	Method  string            // 请求下载地址的方式 默认GET
	Headers map[string]string // 请求下载地址的Headers 默认{}

	Client http.Client // 请求时的Cilent 默认{Timeout:time.Second * 180}
	Body   io.Reader   // 请求时的Body	默认nil

	IsBar bool // 是否显示进度条等信息 默认false

	ContentLength *int64 // 当前下载文件总字节数
	Schedule      *int64 // 当前已经下载的字节数
}

DlerURL 基础结构体

func (*DlerURL) Download

func (dlerurl *DlerURL) Download() error

Download 开始下载

func (*DlerURL) Init

func (dlerurl *DlerURL) Init()

Init 初始化结构体

func (*DlerURL) InitHeaders

func (dlerurl *DlerURL) InitHeaders(request *http.Request)

InitHeaders 初始化Header

func (*DlerURL) IsClientEmpty

func (dlerurl *DlerURL) IsClientEmpty() bool

IsClientEmpty 判断Client是否为空

Jump to

Keyboard shortcuts

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