Documentation ¶
Index ¶
- func BrowseHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func DeleteHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func DownloadHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func GetFileName(path string) string
- func Init(rootDir string)
- func UploadHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- type FileInfo
- type FileStat
- type JSONDeleteRequest
- type JSONResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BrowseHandler ¶
func BrowseHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
BrowseHandler finds a glob of files in directory and returns as JSON output
func DeleteHandler ¶
func DeleteHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
DeleteHandler accepts array of paths and delete them on disk
func DownloadHandler ¶
func DownloadHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
DownloadHandler reads a file and send it contents to response writer
func UploadHandler ¶
func UploadHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
UploadHandler reads a file from HTTP request and save it to disk
Types ¶
type FileInfo ¶
type FileInfo struct { Filename string `json:"filename"` Filepath string `json:"filepath"` Dirpath string `json:"dirpath"` Ext string `json:"ext"` Mime string `json:"mime"` Stat FileStat `json:"stat"` }
FileInfo structure holds data of file
func GetFileInfo ¶
GetFileInfo returns info of the file or error if occurs
type FileStat ¶
type FileStat struct { IsDir bool `json:"isdir"` Mode os.FileMode `json:"mode"` ModTime time.Time `json:"modtime"` Name string `json:"name"` Size int64 `json:"size"` }
FileStat structure holds stat data of a file
type JSONDeleteRequest ¶
type JSONDeleteRequest struct {
Paths []string `json:"paths"`
}
JSONDeleteRequest holds data structure for delete post request
type JSONResponse ¶
type JSONResponse struct { Status int `json:"status"` Data interface{} `json:"data"` }
JSONResponse holds data structure for responses
Click to show internal directories.
Click to hide internal directories.