fileserver

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IEC64

func IEC64(bytes int64) string

IEC64 converts bytes into KiB (1024 bytes), MiB, GiB… as defined within the International System of Quantities (ISQ) standardized by the ISO/IEC 80000 and published in 2008.

Types

type FileServer

type FileServer struct {
	Dir    string
	ResErr reserr.ResErr
}

func (FileServer) ServeDir

func (fs FileServer) ServeDir(contentType string) func(w http.ResponseWriter, r *http.Request)

ServeDir handles the static files using the same Content-Type.

func (FileServer) ServeFile

func (fs FileServer) ServeFile(urlPath, contentType string) func(w http.ResponseWriter, r *http.Request)

ServeFile handles one specific file (and its specific Content-Type).

func (FileServer) ServeImages

func (fs FileServer) ServeImages() func(w http.ResponseWriter, r *http.Request)

ServeImages detects the Content-Type depending on the image extension.

Jump to

Keyboard shortcuts

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