Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigDefault = Config{ Next: nil, Root: nil, PathPrefix: ".", Browse: false, Index: "/index.html", MaxAge: 0, ContentTypeCharset: "", }
ConfigDefault is the default config
View Source
var ErrDirListingNotSupported = errors.New("failed to type-assert to fs.ReadDirFile")
ErrDirListingNotSupported is returned from the filesystem middleware handler if the given fs.FS does not support directory listing. This is uncommon and may indicate an issue with the FS implementation.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Next defines a function to skip this middleware when returned true. // // Optional. Default: nil Next func(c fiber.Ctx) bool // Root is a FileSystem that provides access // to a collection of files and directories. // // Required. Default: nil Root fs.FS `json:"-"` // PathPrefix defines a prefix to be added to a filepath when // reading a file from the FileSystem. // // Optional. Default "." PathPrefix string `json:"path_prefix"` // Enable directory browsing. // // Optional. Default: false Browse bool `json:"browse"` // Index file for serving a directory. // // Optional. Default: "index.html" Index string `json:"index"` // When set to true, enables direct download for files. // // Optional. Default: false. Download bool `json:"download"` // The value for the Cache-Control HTTP-header // that is set on the file response. MaxAge is defined in seconds. // // Optional. Default value 0. MaxAge int `json:"max_age"` // File to return if path is not found. Useful for SPA's. // // Optional. Default: "" NotFoundFile string `json:"not_found_file"` // The value for the Content-Type HTTP-header // that is set on the file response // // Optional. Default: "" ContentTypeCharset string `json:"content_type_charset"` }
Config defines the config for middleware.
Click to show internal directories.
Click to hide internal directories.