Documentation ¶
Overview ¶
Package static 静态文件管理
Index ¶
- func AttachmentFile(ctx *web.Context, fsys fs.FS, name, filename string, inline bool) web.Responser
- func AttachmentFileHandler(fsys fs.FS, name, filename string, inline bool) web.HandlerFunc
- func AttachmentReader(ctx *web.Context, filename string, inline bool, modtime time.Time, ...) web.Responser
- func AttachmentReaderHandler(filename string, inline bool, modtime time.Time, content io.ReadSeeker) web.HandlerFunc
- func ServeFileHandler(fsys fs.FS, name, index string) web.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttachmentFile ¶
AttachmentFile 将文件作为下载对象
name 为相对于 fsys 的文件名; filename 为显示给客户端的文件名,如果为空,则会取 name 的文件名部分; inline 是否在浏览器内打开,主要看浏览器本身是否支持;
func AttachmentFileHandler ¶
AttachmentFileHandler 将 name 作为一个附件提供给客户端
fsys 为文件系统; name 表示地址中表示文件名部分的参数名称; filename 为显示给客户端的文件名,如果为空,则会取 name 的文件名部分; inline 是否在浏览器内打开,主要看浏览器本身是否支持;
func AttachmentReader ¶
func AttachmentReader(ctx *web.Context, filename string, inline bool, modtime time.Time, content io.ReadSeeker) web.Responser
AttachmentReader 将 io.ReadSeeker 作为下载对象
modtime 表示展示给客户端的修改时间;
func AttachmentReaderHandler ¶
func AttachmentReaderHandler(filename string, inline bool, modtime time.Time, content io.ReadSeeker) web.HandlerFunc
func ServeFileHandler ¶
func ServeFileHandler(fsys fs.FS, name, index string) web.HandlerFunc
ServeFileHandler 构建静态文件服务对象
fsys 为文件系统; name 表示地址中表示文件名部分的参数名称。 以 val 表示 name 指定的参数,依以下规则读取内容:
- val 以 / 结尾,读取 val + index 指向的文件,若不存在返回 404;
- val 不以 / 结尾,则被当作普通的文件读取,若不存在返回 404,如果实际表示目录,则读取目录结构;
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.