Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Name string
Size int64
URL string
Extension string
ModTime time.Time
Mode os.FileMode
IsDir bool
Path string // Relative path to Caddyfile
VirtualPath string // Relative path to u.FileSystem
Mimetype string
Content []byte
Type string
UserAllowed bool // Indicates if the user has enough permissions
}
Info contains the information about a particular file or directory
func GetInfo ¶
GetInfo gets the file information and, in case of error, returns the respective HTTP error code
func (Info) CanBeEdited ¶
CanBeEdited checks if the extension of a file is supported by the editor
func (Info) HumanModTime ¶
HumanModTime returns the modified time of the file as a human-readable string.
func (Info) HumanSize ¶
HumanSize returns the size of the file as a human-readable string in IEC format (i.e. power of 2 or base 1024).
func (*Info) RetrieveFileType ¶
RetrieveFileType obtains the mimetype and a simplified internal Type using the first 512 bytes from the file.
func (Info) StringifyContent ¶
StringifyContent returns the string version of Raw
type Listing ¶
type Listing struct {
// The name of the directory (the last element of the path)
Name string
// The full path of the request relatively to a File System
Path string
// The items (files and folders) in the path
Items []Info
// 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
httpserver.Context `json:"-"`
}
A Listing is the context used to fill out a template.
func GetListing ¶
GetListing gets the information about a specific directory and its files.