url

package
v0.0.0-...-5224e43 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package url implements a hapiq downloader that fetches directly from an arbitrary HTTP(S) URL. The "ID" is the URL itself. In manifests use the dedicated url: field:

A URL whose path ends in "/" is treated as a directory: its files are enumerated from the server's JSON index (Caddy file_server browse, nginx autoindex_format json) and fetched into the output directory, subject to the usual --include-ext / --filename-pattern / --limit-files filters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*URLDownloader)

Option configures a URLDownloader.

func WithTimeout

func WithTimeout(t time.Duration) Option

WithTimeout sets the HTTP client timeout.

func WithVerbose

func WithVerbose(v bool) Option

WithVerbose toggles progress logging to stderr.

type URLDownloader

type URLDownloader struct {
	// contains filtered or unexported fields
}

URLDownloader downloads a single file from a user-supplied HTTP(S) URL.

func New

func New(opts ...Option) *URLDownloader

New creates a URLDownloader.

func (*URLDownloader) Download

Download fetches req.ID into req.OutputDir: one file, or -- when the URL addresses a directory -- every file its index lists.

func (*URLDownloader) GetMetadata

func (d *URLDownloader) GetMetadata(ctx context.Context, id string) (*downloaders.Metadata, error)

GetMetadata issues a HEAD request to retrieve size and content-type.

func (*URLDownloader) GetSourceType

func (d *URLDownloader) GetSourceType() string

GetSourceType returns the source identifier.

func (*URLDownloader) Validate

Validate checks that id is a valid http or https URL.

Jump to

Keyboard shortcuts

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