Documentation
¶
Index ¶
- Variables
- func AddDriver(name string, fs DriverFunc)
- func AllDriver()
- func DeleteDriver(name string)
- func DetectFileType(file string) string
- func DriverNames() []string
- func FormatTime(date int64) string
- func HasDriver(name string) bool
- type Driver
- type DriverBase
- type DriverFunc
- type DriverLocal
- func (this DriverLocal) Copy(oldName string, newName string) error
- func (this DriverLocal) CreateDir(path string) error
- func (this DriverLocal) CreateFile(path string) error
- func (this DriverLocal) Delete(paths ...string) error
- func (this DriverLocal) Exists(path string) bool
- func (this DriverLocal) FormatFile(path string) (string, error)
- func (this DriverLocal) Get(path string) (string, error)
- func (this DriverLocal) IsDirectory(path string) bool
- func (this DriverLocal) IsFile(path string) bool
- func (this DriverLocal) Ls(directory string) []map[string]any
- func (this DriverLocal) LsDir(directory string) []map[string]any
- func (this DriverLocal) Move(oldName string, newName string) error
- func (this DriverLocal) Put(path string, contents string) error
- func (this DriverLocal) Read(path string) map[string]any
- func (this DriverLocal) Rename(oldName string, newName string) error
- func (this DriverLocal) Upload(src io.Reader, path string, name string) error
- type Fs
- func (this Fs) Basename(path string) string
- func (this Fs) Copy(oldName string, newName string) error
- func (this Fs) CreateDir(path string) error
- func (this Fs) CreateFile(path string) error
- func (this Fs) Delete(paths ...string) error
- func (this Fs) Exists(path string) bool
- func (this Fs) Extension(path string) string
- func (this Fs) FormatFile(path string) (string, error)
- func (this Fs) Get(path string) (string, error)
- func (this Fs) IsDirectory(path string) bool
- func (this Fs) IsFile(path string) bool
- func (this Fs) Ls(directory string) []map[string]any
- func (this Fs) LsDir(directory string) []map[string]any
- func (this Fs) Move(oldName string, newName string) error
- func (this Fs) ParentPath(path string) string
- func (this Fs) Put(path string, contents string) error
- func (this Fs) Read(path string) map[string]any
- func (this Fs) Rename(oldName string, newName string) error
- func (this Fs) Upload(src io.Reader, path string, name string) error
- type IFs
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultDriver = NewDriver()
默认
View Source
var Filesystem *filesystem.Filesystem
文件管理
Functions ¶
func AddDriver ¶ added in v1.0.2
func AddDriver(name string, fs DriverFunc)
func DeleteDriver ¶ added in v1.0.2
func DeleteDriver(name string)
func DetectFileType ¶ added in v1.0.2
func DriverNames ¶ added in v1.0.2
func DriverNames() []string
Types ¶
type Driver ¶ added in v1.0.2
type Driver struct {
// contains filtered or unexported fields
}
*
- 注册驱动 *
- @create 2023-2-15
- @author deatil
type DriverBase ¶ added in v1.0.2
type DriverBase struct{}
*
- 驱动公共类 *
- @create 2023-2-17
- @author deatil
func (DriverBase) Basename ¶ added in v1.0.2
func (this DriverBase) Basename(path string) string
是否为文件夹
func (DriverBase) Extension ¶ added in v1.0.2
func (this DriverBase) Extension(path string) string
func (DriverBase) ParentPath ¶ added in v1.0.2
func (this DriverBase) ParentPath(path string) string
是否为文件夹
type DriverFunc ¶ added in v1.0.2
type DriverFunc = func() IFs
type DriverLocal ¶ added in v1.0.2
type DriverLocal struct {
DriverBase
// contains filtered or unexported fields
}
*
- 本地文件管理 *
- @create 2023-2-14
- @author deatil
func NewDriverLocal ¶ added in v1.0.2
func NewDriverLocal(rootPath string) DriverLocal
func (DriverLocal) Copy ¶ added in v1.0.3
func (this DriverLocal) Copy(oldName string, newName string) error
复制
func (DriverLocal) CreateDir ¶ added in v1.0.2
func (this DriverLocal) CreateDir(path string) error
创建文件夹
func (DriverLocal) CreateFile ¶ added in v1.0.2
func (this DriverLocal) CreateFile(path string) error
设置权限
func (DriverLocal) Delete ¶ added in v1.0.2
func (this DriverLocal) Delete(paths ...string) error
删除
func (DriverLocal) FormatFile ¶ added in v1.0.2
func (this DriverLocal) FormatFile(path string) (string, error)
func (DriverLocal) Get ¶ added in v1.0.2
func (this DriverLocal) Get(path string) (string, error)
获取
func (DriverLocal) IsDirectory ¶ added in v1.0.2
func (this DriverLocal) IsDirectory(path string) bool
是否为文件夹
func (DriverLocal) Ls ¶ added in v1.0.2
func (this DriverLocal) Ls(directory string) []map[string]any
列出文件及文件夹
func (DriverLocal) LsDir ¶ added in v1.0.2
func (this DriverLocal) LsDir(directory string) []map[string]any
列出文件夹
func (DriverLocal) Move ¶ added in v1.0.2
func (this DriverLocal) Move(oldName string, newName string) error
移动
func (DriverLocal) Put ¶ added in v1.0.2
func (this DriverLocal) Put(path string, contents string) error
覆盖
func (DriverLocal) Read ¶ added in v1.0.2
func (this DriverLocal) Read(path string) map[string]any
详情
type Fs ¶ added in v1.0.1
type Fs struct {
Driver IFs
}
*
- 文件管理器 *
- @create 2023-2-14
- @author deatil
func (Fs) CreateFile ¶ added in v1.0.2
func (Fs) IsDirectory ¶ added in v1.0.1
func (Fs) ParentPath ¶ added in v1.0.2
type IFs ¶ added in v1.0.1
type IFs interface {
Ls(directory string) []map[string]any
LsDir(directory string) []map[string]any
Read(path string) map[string]any
Delete(paths ...string) error
Exists(path string) bool
IsFile(path string) bool
IsDirectory(path string) bool
Get(path string) (string, error)
Put(path string, contents string) error
CreateFile(path string) error
CreateDir(path string) error
Upload(rd io.Reader, path string, name string) error
Rename(oldName string, newName string) error
Move(oldName string, newName string) error
Copy(oldName string, newName string) error
Basename(path string) string
ParentPath(path string) string
Extension(path string) string
FormatFile(path string) (string, error)
}
接口
Click to show internal directories.
Click to hide internal directories.