file

package
v0.88.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package file 提供与文件上下载相关的功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attachment

func Attachment(ctx *web.Context, fsys fs.FS, name, filename string, inline bool) web.Responser

Attachment 提供附件下载服务

name 为相对于 fsys 的文件名; filename 为显示给客户端的文件名,如果为空,则会取 name 的文件名部分; inline 是否在浏览器内打开,主要看浏览器本身是否支持;

func AttachmentHandler

func AttachmentHandler(fsys fs.FS, name, filename string, inline bool) web.HandlerFunc

AttachmentHandler 将 name 作为一个附件提供给客户端

fsys 为文件系统; name 表示地址中表示文件名部分的参数名称; filename 为显示给客户端的文件名,如果为空,则会取 name 的文件名部分; inline 是否在浏览器内打开,主要看浏览器本身是否支持;

func ServeFile

func ServeFile(ctx *web.Context, fsys fs.FS, name, index string) web.Responser

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL