Documentation
¶
Overview ¶
Package file 提供与文件上下载相关的功能
Index ¶
- func Attachment(ctx *web.Context, fsys fs.FS, name, filename string, inline bool) web.Responser
- func AttachmentHandler(fsys fs.FS, name, filename string, inline bool) web.HandlerFunc
- func ServeFile(ctx *web.Context, fsys fs.FS, name, index string) web.Responser
- func ServeFileHandler(fsys fs.FS, name, index string) web.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attachment ¶
Attachment 提供附件下载服务
name 为相对于 fsys 的文件名; filename 为显示给客户端的文件名,如果为空,则会取 name 的文件名部分; inline 是否在浏览器内打开,主要看浏览器本身是否支持;
func AttachmentHandler ¶
AttachmentHandler 将 name 作为一个附件提供给客户端
fsys 为文件系统; name 表示地址中表示文件名部分的参数名称; filename 为显示给客户端的文件名,如果为空,则会取 name 的文件名部分; inline 是否在浏览器内打开,主要看浏览器本身是否支持;
func ServeFile ¶
ServeFile 提供了静态文件服务
name 表示需要读取的文件名,相对于 fsys; index 表示 name 为目录时,默认读取的文件,为空表示 index.html;
func ServeFileHandler ¶
func ServeFileHandler(fsys fs.FS, name, index string) web.HandlerFunc
ServeFileHandler 构建静态文件服务对象
fsys 为文件系统; name 表示地址中表示文件名部分的参数名称; index 表示目录下的默认文件名;
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.