Documentation ¶
Overview ¶
Package http provides methods for gathering HTTP resources. This package implements the Gatherer interface and provides methods for downloading files from HTTP sources, retrieving metadata of the downloaded file, and handling HTTP requests.
The HTTPGatherer struct represents an HTTP gatherer and contains a http.Client for making HTTP requests. It implements the Gatherer interface's Gather method to download files from HTTP sources and return the metadata of the downloaded file.
Example usage:
httpGatherer := http.NewHTTPGatherer() metadata, err := httpGatherer.Gather(context.Background(), "http://example.com/file.txt", "/path/to/destination/with/optional/filename.txt") if err != nil { fmt.Println("Error:", err) return } fmt.Println("Downloaded file metadata:", metadata)
Note: The Gather method uses the http.Client's default timeout of 15 seconds for the HTTP requests. You can customize the timeout by modifying the http.Client's Timeout field before calling the Gather method.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPGatherer ¶
func NewHTTPGatherer ¶
func NewHTTPGatherer() *HTTPGatherer