net

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package net is network utilities.

Index

Constants

This section is empty.

Variables

View Source
var WithBase = funcopt.New(func(params *fetchParams, base string) {
	params.base = base
})

WithBase sets the basename of the output file.

View Source
var WithDir = funcopt.NewFailable(func(params *fetchParams, dir string) error {
	if _, err := os.Stat(dir); os.IsNotExist(err) {
		return fmt.Errorf("directory does not exist: %s", dir)
	}
	params.dir = dir
	return nil
})

WithDir sets the working directory for the fetch operation.

View Source
var WithMaxRedirs = funcopt.New(func(params *fetchParams, maxredirs int) {
	params.maxredirs = maxredirs
})

WithMaxRedirs sets the maximum number of redirections to follow. Zero does not follow redirections. Negative number uses the default of the underlying library.

View Source
var WithStderr = funcopt.New(func(params *fetchParams, stderr io.Writer) {
	params.stderr = stderr
})

WithStderr sets the stderr stream for the fetch operation.

View Source
var WithVerbose = funcopt.New(func(params *fetchParams, verbose bool) {
	params.verbose = verbose
})

WithVerbose sets the verbosity.

Functions

func Fetch

func Fetch(url string, opts ...funcopt.Option[fetchParams]) (err error)

Fetch downloads a file from the given URL to the local filesystem.

Types

This section is empty.

Jump to

Keyboard shortcuts

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