Help us shape the future of Go! Take the 2026 Go Developer Survey

download

package
v0.233.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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