download

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package download handles the client file downloads.

Index

Constants

This section is empty.

Variables

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

Functions

func Checksum

func Checksum(c echo.Context, db *sql.DB, id 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.

Types

type Download

type Download struct {
	Path   string // Path 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(c echo.Context, db *sql.DB, logger *zap.SugaredLogger) 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 {
	ExtraPath    string // ExtraPath is the absolute path to the extra directory.
	DownloadPath string // DownloadPath is the absolute path to the download directory.
}

ExtraZip configuration.

func (ExtraZip) HTTPSend added in v0.9.0

func (e ExtraZip) HTTPSend(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 obsolute file types that have been rearchived into a standard zip file.

Jump to

Keyboard shortcuts

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