http

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const RefreshRate = time.Millisecond * 100

Variables

This section is empty.

Functions

func DownloadFile

func DownloadFile(uri, filename string) error

DownloadFile downloads file from the internet, based on the uri. based on the https://golangcode.com/download-a-file-with-progress/ and comments

Types

type HTTPClient

type HTTPClient interface {
	Get(url string) (*http.Response, error)
}

HTTPClient interface

var (
	Client HTTPClient
)

type WriteCounter added in v0.1.2

type WriteCounter struct {
	Total int // bytes read so far
	// contains filtered or unexported fields
}

WriteCounter counts the number of bytes written to it. It implements to the io.Writer interface and we can pass this into io.TeeReader() which will report progress on each write cycle.

func NewWriteCounter added in v0.1.2

func NewWriteCounter(total int) *WriteCounter

func (*WriteCounter) Finish added in v0.1.2

func (wc *WriteCounter) Finish()

func (*WriteCounter) Start added in v0.1.2

func (wc *WriteCounter) Start()

func (*WriteCounter) Write added in v0.1.2

func (wc *WriteCounter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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