http

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

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

type HTTPGatherer struct {
	Client http.Client
}

func NewHTTPGatherer

func NewHTTPGatherer() *HTTPGatherer

func (*HTTPGatherer) Gather

func (h *HTTPGatherer) Gather(ctx context.Context, source, destination string) (metadata.Metadata, error)

Jump to

Keyboard shortcuts

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