dolo

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 9 Imported by: 14

README

dolo

Golang module for file download. Dolo skips downloading if the file exists and has the same content length. Dolo supports an optional callback that notifies on progress.

Exported methods

  • NewClient(httpClient *http.Client, notify func(uint64, uint64)) - creates a new dolo client using the provided http.Client (with cookie jar, etc.) and an optional callback to notify on progress. Optional callback takes two values - downloaded bytes and total bytes.

  • Download(url *url.URL, dstDir string, overwrite bool) - downloads a resource at the URL to the destination directory (original resource base path would be used for a filename). Overwrite would require download even if the destination file already exists and has the same content length.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(httpClient *http.Client, notify func(uint64, uint64), opts *ClientOptions) *Client

func (*Client) Download

func (dolo *Client) Download(url *url.URL, dstDir, dstFilename string) (network bool, err error)

type ClientOptions

type ClientOptions struct {
	Attempts           int
	DelayAttempts      int
	MinSizeComplete    int64
	CheckContentLength bool
	ResumeDownloads    bool
	Verbose            bool
}

func Defaults

func Defaults() *ClientOptions

Jump to

Keyboard shortcuts

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