downloader

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadPDF

func DownloadPDF(urlStr string, tmp bool, prefix string, progress func(done, total int64)) (string, error)

DownloadPDF fetches the PDF and saves locally. tmp==true → os.TempDir(), else under $PDF_DIR/prefix or $PDF_DIR. progress is an optional callback receiving bytes downloaded and total bytes.

func SetDownloadTimeout added in v1.0.0

func SetDownloadTimeout(d time.Duration)

SetDownloadTimeout updates the timeout for DownloadPDF requests.

func SetSniffTimeout added in v1.0.0

func SetSniffTimeout(d time.Duration)

SetSniffTimeout updates the timeout for SniffMime requests.

func SniffHandler added in v1.0.0

func SniffHandler(c *gin.Context)

SniffHandler responds with the MIME type of the ?url parameter.

func SniffMime added in v1.0.0

func SniffMime(urlStr string) (string, error)

SniffMime fetches the first few bytes of urlStr and returns the detected MIME type. It uses the Content-Type header as a fallback if detection fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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