download

package
v0.266.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilenameFromURL added in v0.216.0

func FilenameFromURL(url, contentType string) string

FilenameFromURL extracts a safe filename from a URL. When the URL path has no extension, the response Content-Type is used to derive one (e.g. image/png -> .png), falling back to .dat for unknown types.

func NewProgressReader

func NewProgressReader(src io.Reader, report func(string), label string, total int64) io.Reader

NewProgressReader wraps src only when report is set, so the no-listener case (headless, tests) stays a plain read with no bookkeeping.

func ToFile

func ToFile(ctx context.Context, client *http.Client, url, dstPath, label string, report func(string)) error

ToFile atomically fetches url into dstPath, reporting progress through report (nil for none), and rejects transfers shorter than their declared Content-Length.

Types

This section is empty.

Jump to

Keyboard shortcuts

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