Documentation
¶
Overview ¶
Package storage 实现存储管理与文件管理:登记本地目录或远程 WebDAV 作为挂载点, 并提供浏览器内的文件浏览、上传、下载、新建目录、重命名与删除。
Index ¶
- Constants
- type Entry
- type Module
- func (m *Module) ID() string
- func (m *Module) Init(env module.Env) error
- func (m *Module) ListNames(mount, dir string) ([]string, error)
- func (m *Module) MountList() []MountInfo
- func (m *Module) PutFile(mount, dir, name string, data []byte) error
- func (m *Module) RemoveFile(mount, p string) error
- func (m *Module) Routes(r module.Router)
- func (m *Module) Start(context.Context) error
- func (m *Module) Stop() error
- func (m *Module) Summary() []module.SummaryItem
- func (m *Module) Title() string
- type Mount
- type MountInfo
Constants ¶
View Source
const ( TypeLocal = "local" TypeWebDAV = "webdav" )
挂载类型。
View Source
const ID = "storage"
ID 是模块标识。
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Name string `json:"name"`
IsDir bool `json:"isDir"`
Size int64 `json:"size"`
ModTime time.Time `json:"modTime"`
}
Entry 是目录列表中的一项。
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module 是存储模块。
func (*Module) RemoveFile ¶
RemoveFile 删除挂载点内的文件。
func (*Module) Summary ¶
func (m *Module) Summary() []module.SummaryItem
Summary 实现 module.Summarizer。
type Mount ¶
type Mount struct {
Key string `json:"key"`
Name string `json:"name"`
Type string `json:"type"`
Remark string `json:"remark"`
Enable bool `json:"enable"`
// ReadOnly 为 true 时文件管理拒绝一切写操作
ReadOnly bool `json:"readOnly"`
// Path 是本地目录(绝对路径),Type 为 local 时使用
Path string `json:"path"`
// 以下字段在 Type 为 webdav 时使用
URL string `json:"url"`
Username string `json:"username"`
Password string `json:"password"`
SkipVerify bool `json:"skipVerify"`
}
Mount 是一个存储挂载点。
Click to show internal directories.
Click to hide internal directories.