Documentation ¶
Index ¶
- type FileDownloader
- func (downloader FileDownloader) Get(destination, source string) error
- func (downloader FileDownloader) GetRemoteContents(URL string) ([]byte, error)
- func (downloader FileDownloader) GetWithFallback(destination, source string, fallbackSources ...string) error
- func (downloader FileDownloader) ReadLocalFile(path string) ([]byte, error)
- type HTTPClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileDownloader ¶
type FileDownloader struct {
// contains filtered or unexported fields
}
FileDownloader ...
func NewWithContext ¶
func NewWithContext(context context.Context, client HTTPClient) FileDownloader
NewWithContext ...
func (FileDownloader) Get ¶
func (downloader FileDownloader) Get(destination, source string) error
Get downloads a file from a given source. Provided destination should be a file that does not exist.
func (FileDownloader) GetRemoteContents ¶
func (downloader FileDownloader) GetRemoteContents(URL string) ([]byte, error)
GetRemoteContents fetches a remote URL contents
func (FileDownloader) GetWithFallback ¶
func (downloader FileDownloader) GetWithFallback(destination, source string, fallbackSources ...string) error
GetWithFallback downloads a file from a given source. Provided destination should be a file that does not exist. You can specify fallback sources which will be used in order if downloading fails from either source.
func (FileDownloader) ReadLocalFile ¶
func (downloader FileDownloader) ReadLocalFile(path string) ([]byte, error)
ReadLocalFile returns a local file contents
Click to show internal directories.
Click to hide internal directories.