Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var URICopy = DefaultFetcher.CopyLocal
URICopy Wraps opening and copying content from URIs. Will attempt directly perform file copies if the uri is begins with file://, otherwise delegates to a curl implementation.
Functions ¶
This section is empty.
Types ¶
type BasicFetcher ¶
BasicFetcher can access "file" and "http" schemes using the OS and a provided HTTP client, respectively.
func (BasicFetcher) CopyLocal ¶
func (f BasicFetcher) CopyLocal(srcUri *url.URL, dstPath string) (err error)
func (BasicFetcher) Open ¶
func (f BasicFetcher) Open(u *url.URL) (io.ReadCloser, error)
type Fetcher ¶
type Fetcher interface { // Opens a data stream to the source URI. If no URI scheme is // specified, treats the URI as a path to a local file. Open(uri *url.URL) (io.ReadCloser, error) Head(uri *url.URL) (*http.Response, error) // Copy all data from the source URI to a local file at the // destination path. CopyLocal(srcUri *url.URL, dstPath string) error }
A UriFetcher presents simple methods for fetching URIs from different schemes.
var DefaultFetcher Fetcher = BasicFetcher{http.DefaultClient}
A default fetcher, if the user doesn't want to set any options.
type LoggedFetcher ¶
type LoggedFetcher struct { SrcUri *url.URL DstPath string // contains filtered or unexported fields }
A LoggedFetcher wraps another uri.Fetcher, forwarding all calls and recording their arguments. Useful for unit testing.
func NewLoggedFetcher ¶
func NewLoggedFetcher(fetcher Fetcher) *LoggedFetcher
func (*LoggedFetcher) CopyLocal ¶
func (f *LoggedFetcher) CopyLocal(srcUri *url.URL, dstPath string) error
func (*LoggedFetcher) Open ¶
func (f *LoggedFetcher) Open(srcUri *url.URL) (io.ReadCloser, error)
Click to show internal directories.
Click to hide internal directories.