Documentation ¶
Index ¶
Constants ¶
const MIMEOctetStream = "application/octet-stream"
Variables ¶
This section is empty.
Functions ¶
func New
deprecated
func New(urlPrefix string, root http.FileSystem, opts ...Option) app.HandlerFunc
New creates a new middleware handler.
filesystem does not handle url encoded values (for example spaces) on its own.
Deprecated: use NewFSHandler instead.
func NewFSHandler ¶
NewFSHandler creates a new middleware handler.
Types ¶
type Option ¶
type Option func(o *option)
func WithIndexFile ¶
WithIndexFile Index file for serving a directory.
func WithMaxAge ¶
WithMaxAge The value for the Cache-Control HTTP-header that is set on the file response. MaxAge is defined in seconds.
func WithNotFoundFile ¶
WithNotFoundFile File to return if path is not found. Useful for SPA's.
func WithPathPrefix ¶
WithPathPrefix PathPrefix defines a prefix to be added to a filepath when reading a file from the FileSystem.
Use when using Go 1.16 embed.FS
func WithPreHandler ¶
func WithPreHandler(handler preHandler) Option
WithPreHandler PreHandler is executed before the filesystem middleware. If the handler returns false, the middleware will abort with a 401 status by default.
If the handler returns false and a custom fallback function is returned, the middleware will abort with the custom fallback function.