Documentation
¶
Index ¶
- Variables
- type LocalDriver
- func (d *LocalDriver) Delete(path string) error
- func (d *LocalDriver) Exists(path string) bool
- func (d *LocalDriver) Get(path string) ([]byte, error)
- func (d *LocalDriver) Put(path string, content []byte) error
- func (d *LocalDriver) PutFile(path string, reader io.Reader) error
- func (d *LocalDriver) Size(path string) (int64, error)
- func (d *LocalDriver) URL(path string) string
- type Manager
- type Storage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFileNotFound = errors.New("storage: file not found") ErrInvalidPath = errors.New("storage: invalid path") )
Functions ¶
This section is empty.
Types ¶
type LocalDriver ¶
type LocalDriver struct {
// contains filtered or unexported fields
}
LocalDriver 本地存储驱动
func NewLocalDriver ¶
func NewLocalDriver(root string, baseURL string) *LocalDriver
NewLocalDriver 创建本地驱动
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager 存储管理器
type Storage ¶
type Storage interface {
// Put 存储文件
Put(path string, content []byte) error
// PutFile 存储文件(从 Reader)
PutFile(path string, reader io.Reader) error
// Get 获取文件内容
Get(path string) ([]byte, error)
// Exists 检查文件是否存在
Exists(path string) bool
// Delete 删除文件
Delete(path string) error
// URL 获取文件访问 URL
URL(path string) string
// Size 获取文件大小
Size(path string) (int64, error)
}
Storage 存储接口
Click to show internal directories.
Click to hide internal directories.