downloader

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
	Accept    = "" /* 135-byte string literal not displayed */
)

Variables

This section is empty.

Functions

func DirectoryName

func DirectoryName(p kemono.Post) string

func NewDownloader

func NewDownloader(options ...DownloadOption) kemono.Downloader

Types

type DownloadOption

type DownloadOption func(*downloader)

func Async

func Async(async bool) DownloadOption

Async set the async download option

func BaseURL

func BaseURL(baseURL string) DownloadOption

BaseURL set the base url

func MaxConcurrent

func MaxConcurrent(maxConcurrent int) DownloadOption

MaxConcurrent set the max concurrent download

func MaxSize added in v0.0.2

func MaxSize(maxSize int64) DownloadOption

MaxSize set the max size of the file to download

func MinSize added in v0.0.2

func MinSize(minSize int64) DownloadOption

MinSize set the min size of the file to download

func OverWrite

func OverWrite(overwrite bool) DownloadOption

OverWrite set the overwrite option

func RateLimit

func RateLimit(n int) DownloadOption

limit the rate of download per second

func Retry

func Retry(retry int) DownloadOption

func RetryInterval

func RetryInterval(interval time.Duration) DownloadOption

func SavePath

func SavePath(savePath func(creator kemono.Creator, post kemono.Post, i int, attachment kemono.File) string) DownloadOption

func SetLog

func SetLog(log Log) DownloadOption

SetLog set the log

func Timeout

func Timeout(timeout time.Duration) DownloadOption

Timeout set the timeout

func WithHeader

func WithHeader(header Header) DownloadOption
type Header map[string]string

type Log

type Log interface {
	Printf(format string, v ...interface{})
	Print(s string)
	SetStatus(s []string)
}

Jump to

Keyboard shortcuts

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