package filedownloader
import "github.com/bitrise-io/go-utils/filedownloader"
Index ¶
- type FileDownloader
- func New(client HTTPClient) FileDownloader
- func NewWithContext(context context.Context, client HTTPClient) 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
Types ¶
type FileDownloader ¶
type FileDownloader struct {
// contains filtered or unexported fields
}
FileDownloader ...
func New ¶
func New(client HTTPClient) FileDownloader
New ...
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
type HTTPClient ¶
HTTPClient ...
Source Files ¶
- Version
- v1.0.15 (latest)
- Published
- May 13, 2025
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 2 months ago –
Tools for package owners.