download

package
v1.14.17 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: GPL-3.0 Imports: 20 Imported by: 1 module, 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

Overview

Package download handles the client file downloads.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNone = errors.New("download: not found")
	ErrStat = errors.New("download: file kept on this server cannot be found")
)

Functions

func Checksum

func Checksum(ctx context.Context, c *echo.Context, db *sql.DB, obfsKey string) error

Checksum serves the checksums for the requested file. The response is a text file named "checksums.txt" with the checksum and filename. The id string is the UID filename of the requested file.

func LastModified added in v1.9.11

func LastModified(art *models.File) string

LastModified returns the last modification date and time that can be used with a HTTP Last-Modified [header].

RFC1123     = "Mon, 02 Jan 2006 15:04:05 MST"

example output: Wed, 21 Oct 2015 07:28:00 GMT [header]:https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Last-Modified

Types

type Download

type Download struct {
	Dir    dir.Directory // Dir is the absolute path to the download directory.
	Inline bool          // Inline is true if the file should attempt to display in the browser.
}

Download configuration.

func (Download) HTTPSend

func (d Download) HTTPSend(sl *slog.Logger, c *echo.Context, db *sql.DB) error

HTTPSend serves files to the client and prompts for a save location. The download relies on the URL ID parameter to determine the requested file.

type ExtraZip added in v0.9.0

type ExtraZip struct {
	Extra    dir.Directory // Extra is the absolute path to the extra directory.
	Download dir.Directory // Download is the absolute path to the download directory.
}

ExtraZip configuration.

func (ExtraZip) HTTPSend added in v0.9.0

func (e ExtraZip) HTTPSend(ctx context.Context, c *echo.Context, db *sql.DB) error

HTTPSend looks for any zip files in the extra directory and serves them to the client, otherwise it will serve the standard download file.

This is used for obsolete file types that have been re-archived into a standard zip file.

Jump to

Keyboard shortcuts

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