fetcher

package
v0.15.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package fetcher provides a mechanism for fetching files from URLs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Timeout is the request timeout.
	Timeout time.Duration

	// Skip verification of insecure transports.
	InsecureSkipVerify bool
}

Config parameterizes Fetcher behavior.

type Fetcher

type Fetcher struct {
	Config *Config
}

Fetcher can fetch files from URLs. If field Config is nil, defaults are used. At this time, only HTTP/HTTPS is supported, but it's possible other schemes (such as FTP) will be supported in future.

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(ctx context.Context, url string, w io.Writer) error

Fetch writes the body of the document at url to w.

func (*Fetcher) Schemes

func (f *Fetcher) Schemes() []string

Schemes is the set of supported schemes.

func (*Fetcher) Supported

func (f *Fetcher) Supported(loc string) bool

Supported returns true if loc is a supported URL.

Jump to

Keyboard shortcuts

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