Documentation ¶
Overview ¶
Package browse provides middleware for listing files in a directory when directory path is requested instead of a specific file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var IndexPages = []string{
"index.html",
"index.htm",
"default.html",
"default.htm",
}
Functions ¶
func New ¶
func New(c middleware.Controller) (middleware.Middleware, error)
New creates a new instance of browse middleware.
Types ¶
type Browse ¶
type Browse struct { Next middleware.Handler Root string Configs []BrowseConfig }
Browse is an http.Handler that can show a file listing when directories in the given paths are specified.
type BrowseConfig ¶
BrowseConfig is a configuration for browsing in a particular path.
type FileInfo ¶
type FileInfo struct { IsDir bool Name string Size int64 URL string ModTime time.Time Mode os.FileMode }
FileInfo is the info about a particular file or directory
func (FileInfo) HumanModTime ¶
type Listing ¶
type Listing struct { // The name of the directory (the last element of the path) Name string // The full path of the request Path string // Whether the parent directory is browsable CanGoUp bool // The items (files and folders) in the path Items []FileInfo }
A Listing is used to fill out a template.
Click to show internal directories.
Click to hide internal directories.