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 ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Browse ¶
type Browse struct { Next httpserver.Handler Configs []Config IgnoreIndexes bool }
Browse is an http.Handler that can show a file listing when directories in the given paths are specified.
type Config ¶
type Config struct { PathScope string Root http.FileSystem Variables interface{} Template *template.Template }
Config 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 ¶
HumanModTime returns the modified time of the file as a human-readable string.
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 // The number of directories in the listing NumDirs int // The number of files (items that aren't directories) in the listing NumFiles int // Which sorting order is used Sort string // And which order Order string // If ≠0 then Items have been limited to that many elements ItemsLimitedTo int // Optional custom variables for use in browse templates User interface{} httpserver.Context }
A Listing is the context used to fill out a template.
func (Listing) BreadcrumbMap ¶
BreadcrumbMap returns l.Path where every element is a map of URLs and path segment names.
Click to show internal directories.
Click to hide internal directories.