1 Star 0 Fork 0

TGodfather / misc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
options.go 567 Bytes
一键复制 编辑 原始数据 按行查看 历史
zhuokang_tan 提交于 2022-09-27 18:03 . webcenter:modify\n httpfs:add
package httpfs
import "strings"
type HfsOptions struct {
pathPrefix string // 打开文件时,自动填补 PathPrefix, 如 abc.js , 实际打开 ${PathPrefix}/abc.js
indexName string // 打开路径为/ 时, 自动替换为 indexName, 默认为 "index.html"
}
type HfsOption func(*HfsOptions)
func WithPathPrefix(s string) HfsOption {
return func(opts *HfsOptions) {
if !strings.HasSuffix(s, "/") {
s = s + "/"
}
opts.pathPrefix = s
}
}
func WithIndexFile(s string) HfsOption {
return func(opts *HfsOptions) {
opts.indexName = s
}
}
Go
1
https://gitee.com/tgodfather/misc.git
git@gitee.com:tgodfather/misc.git
tgodfather
misc
misc
4dc1fac3246d

搜索帮助