Documentation ¶
Index ¶
- func BuildDsn(conf config) string
- func ReadDir(vfs FileSystem, name string) ([]fs.DirEntry, error)
- func ReadFile(vfs FileSystem, name string) ([]byte, error)
- func RegisterDriver(driver string, d Driver)
- func WriteFile(vfs FileSystem, name string, data []byte) error
- type Config
- func (conf *Config) Decode(query url.Values) error
- func (conf *Config) Driver() string
- func (conf *Config) Encode() url.Values
- func (conf *Config) Host() string
- func (conf *Config) Path() string
- func (conf *Config) StringDecode(querystring string) error
- func (conf *Config) StringEncode() string
- func (conf *Config) UserInfo() *url.Userinfo
- type Driver
- type File
- type FileSystem
- type OpenFileFs
- type ReadDirFS
- type ReadDirFile
- type ReadFileFS
- type WriteFileFS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadDir ¶
func ReadDir(vfs FileSystem, name string) ([]fs.DirEntry, error)
ReadDir see fs.ReadDir
func RegisterDriver ¶
RegisterDriver register FileSystem
Types ¶
type FileSystem ¶
type FileSystem interface { // Open opens the named file for reading. // if file not exist, the error is os.ErrNotExist. Open(name string) (File, error) // Create creates the named file with mode 0666 (before umask), truncating // it if it already exists. If successful, methods on the returned // File can be used for writing; the associated file descriptor has // mode O_RDWR. // If there is an error, it will be of type *PathError. Create(name string) (File, error) // Mkdir creates a new directory with the specified name and permission // bits (before umask). // If there is an error, it will be of type *PathError. Mkdir(name string, perm os.FileMode) error // MkdirAll creates a directory named path, // along with any necessary parents, and returns nil, // or else returns an error. // The permission bits perm (before umask) are used for all // directories that MkdirAll creates. // If path is already a directory, MkdirAll does nothing // and returns nil. MkdirAll(path string, perm os.FileMode) error // Remove removes the named file or (empty) directory. // If there is an error, it will be of type *PathError. Remove(name string) error // RemoveAll removes path and any children it contains. // It removes everything it can but returns the first error // it encounters. If the path does not exist, RemoveAll // returns nil (no error). RemoveAll(path string) error // Rename renames (moves) oldpath to newpath. // If newpath already exists and is not a directory, Rename replaces it. // OS-specific restrictions may apply when oldpath and newpath are in different directories. // If there is an error, it will be of type *LinkError. Rename(oldpath, newpath string) error // Sub returns a Filesystem that is backed by the receiver Sub(dir string) (FileSystem, error) // Stat returns a FileInfo describing the named file. Stat(name string) (os.FileInfo, error) // Exists checks if the file exists Exists(name string) bool // IsFile returns true if the given path is a file IsFile(name string) bool // IsDir returns true if the given path is a directory IsDir(name string) bool }
func Open ¶
func Open(dns string) (FileSystem, error)
Open driver, return fs.FS and error use uri.Scheme to get driver use uri.User to get auth use uri.Host to get host use uri.Path to get root path use uri.RawQuery to get setting eg. os:///tmp/filesystem?a=1&b=2
memory:///?maxsize=10240000 s3://user:pass@host/bucket?region=us-east-1 ftp://user:pass@host/path?passive=true sftp://user:pass@host/path?passive=true
type OpenFileFs ¶
type OpenFileFs interface { FileSystem // OpenFile see os.OpenFile OpenFile(name string) (File, error) }
type ReadDirFS ¶
type ReadDirFS interface { FileSystem // ReadDir see fs.ReadDirFS ReadDir(name string) ([]fs.DirEntry, error) }
type ReadDirFile ¶
type ReadFileFS ¶
type ReadFileFS interface { FileSystem // ReadFile see fs.ReadFile ReadFile(name string) ([]byte, error) }
type WriteFileFS ¶
type WriteFileFS interface { FileSystem // WriteFile see os.WriteFile WriteFile(name string, data []byte) error }
Click to show internal directories.
Click to hide internal directories.