httputils

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFromURL

func DownloadFromURL(URL string) ([]byte, error)

DownloadFromURL downloads a file from an URL and returns the content as a slice of bytes

func IsValidURL

func IsValidURL(strURL string) bool

IsValidURL checks whether the given string is a valid URL or not

Types

type Downloader

type Downloader struct {
	Timeout time.Duration
}

func NewDownloader

func NewDownloader(opts ...DownloaderOption) *Downloader

NewDownloader creates a new Downloader to download files from an URL

func (Downloader) DownloadFromURL

func (d Downloader) DownloadFromURL(URL string) ([]byte, error)

DownloadFromURL downloads a file from an URL and returns the content as a slice of bytes

type DownloaderOption

type DownloaderOption func(*Downloader)

func WithTimeout

func WithTimeout(timeout time.Duration) DownloaderOption

WithTimeout sets a timeout on the underlying HTTP client

Jump to

Keyboard shortcuts

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