Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefaultFSFactory ¶
func SetDefaultFSFactory(factory FileSystemFactory) error
SetDefaultFSFactory 在调用 Default() 之前,必须设置默认的工厂
Types ¶
type FS ¶
type FS interface { NewPath(path string) Path ListRoots() []Path CreateTempFile(prefix, suffix string, dir Path) (Path, error) // PathSeparator return ';'(windows) | ':'(unix) PathSeparator() string // Separator return '/'(unix) | '\'(windows) Separator() string }
FS 是表示文件系统的接口
type FileIO ¶
type FileIO interface { Path() Path OpenReader(opt *Options) (io.ReadCloser, error) OpenWriter(opt *Options) (io.WriteCloser, error) OpenSeekerR(opt *Options) (ReadSeekCloser, error) OpenSeekerW(opt *Options) (WriteSeekCloser, error) OpenSeekerRW(opt *Options) (ReadWriteSeekCloser, error) ReadText(opt *Options) (string, error) WriteText(text string, opt *Options) error WriteBinary(b []byte, opt *Options) error ReadBinary(opt *Options) ([]byte, error) }
FileIO ...
type FileInfo ¶
type FileInfo interface { Path() Path Length() int64 CreatedAt() time.Time UpdatedAt() time.Time Mode() fs.FileMode Exists() bool IsFile() bool IsDirectory() bool }
FileInfo ...
type FileSystemFactory ¶
type FileSystemFactory interface {
Create() FS
}
FileSystemFactory 是用来创建 FS 对象的工厂
type Options ¶
type Options struct { // file with fs.ModeXXX Permission fs.FileMode // fill with os.O_xxxx Flag int Mkdirs bool Create bool }
Options ...
type Path ¶
type Path interface { Exists() bool IsFile() bool IsDirectory() bool GetName() string GetPath() string GetInfo() FileInfo String() string GetFS() FS GetParent() Path GetChild(name string) Path ListNames() []string ListPaths() []string ListChildren() []Path Mkdir(opt *Options) error Mkdirs(opt *Options) error Delete() error Create(opt *Options) error CreateWithData(data []byte, opt *Options) error CreateWithSource(src io.Reader, opt *Options) error MoveTo(dst Path) error CopyTo(dst Path, opt *Options) error GetIO() FileIO }
Path 是表示绝对路径的接口
type ReadSeekCloser ¶ added in v0.0.4
type ReadSeekCloser interface { io.Closer io.ReadSeeker }
ReadSeekCloser ...
type ReadWriteSeekCloser ¶ added in v0.0.4
type ReadWriteSeekCloser interface { io.Closer io.ReadWriteSeeker }
ReadWriteSeekCloser ...
type WriteSeekCloser ¶ added in v0.0.4
type WriteSeekCloser interface { io.Closer io.WriteSeeker }
WriteSeekCloser ...
Click to show internal directories.
Click to hide internal directories.