downloader

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: MIT Imports: 17 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 → user temp dir, else under user PDF dir/prefix. progress is an optional callback receiving bytes downloaded and total bytes.

func DownloadPDFForUser added in v1.4.0

func DownloadPDFForUser(urlStr string, tmp bool, prefix string, userID uuid.UUID, progress func(done, total int64)) (string, error)

DownloadPDFForUser fetches the PDF and saves to temp directory. The tmp parameter is kept for compatibility but all downloads now go to temp. Archival to storage backend happens later in the pipeline. 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