fetch

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTimeout is the default timeout for fetching the URL.
	DefaultTimeout = 60 * time.Second

	// DefaultBackOff is the default backoff strategy for fetching the URL.
	DefaultBackOff = &backoff.StopBackOff{}
)

Functions

func NewDecompressionReader

func NewDecompressionReader(r io.ReadCloser) (io.ReadCloser, error)

NewDecompressionReader will return a new reader transparently doing decompression of GZip, BZip2, and ZStd.

func Open

func Open(addr string, opts ...Option) (io.ReadCloser, error)

Open will fetch address addr using the given options.

Types

type Option

type Option func(*params)

Option is an option for opening a URL.

func WithBackoff

func WithBackoff(backOff backoff.BackOff) Option

WithBackoff will set the backoff strategy for the fetch operation.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout will set the timeout duration for the fetch operation.

Jump to

Keyboard shortcuts

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