httpdownloader

package module
v0.0.0-...-a8bf867 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2024 License: MIT Imports: 13 Imported by: 0

README

httpdownloader

This is a Golang module for easy file upload over http.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMD5sum

func CheckMD5sum(ctx context.Context, pathToFile, requiredMD5sum string) error

Calculates the md5sum of the specified file and compares it with the provided one.

func CopyByChunks

func CopyByChunks(ctx context.Context, src io.Reader, dst io.Writer, readBuffer int) (nBytes int64, err error)

Copying the content in parts from reader to specified writer, with Golang context.

func MD5sum

func MD5sum(ctx context.Context, file io.Reader) (string, error)

MD5Sum calculates md5 digest of the given content

Types

type Downloader

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

func NewDownloader

func NewDownloader(retries int, httpClient *http.Client) Downloader

func (*Downloader) DownloadFile

func (d *Downloader) DownloadFile(ctx context.Context, urlToFile, dstLocalFilePath string, permissions fs.FileMode) error

Jump to

Keyboard shortcuts

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