Documentation
¶
Index ¶
- func Append(path, contents string) error
- func Copy(src, dst string) error
- func CopyFile(src, dst string) error
- func Delete(path string) error
- func Exists(path string) bool
- func FileInfo(path string) (os.FileInfo, error)
- func Get(path string) (string, error)
- func Info(path string) (os.FileInfo, error)
- func IsDir(path string) bool
- func IsFile(path string) bool
- func LastModified(path string) (time.Time, error)
- func Mkdir(path string) error
- func Move(src, dst string) error
- func Prepend(path, contents string) error
- func Put(path, content string) error
- func Read(path string) (string, error)
- func ReadDir(path string) ([]os.FileInfo, error)
- func ReadFile(path string) (string, error)
- func Remove(path string) error
- func Rename(src, dst string) error
- func Size(path string) (int64, error)
- func Stat(path string) (os.FileInfo, error)
- func WriteFile(path, content string) error
- type Config
- type Drive
- type LocalDrive
- func (l *LocalDrive) AllFiles(directory string) (files []string, err error)
- func (l *LocalDrive) Append(path, contents string) error
- func (l *LocalDrive) Copy(from, to string) error
- func (l *LocalDrive) Delete(path string) error
- func (l *LocalDrive) Exists(path string) bool
- func (l *LocalDrive) Files(directory string) (files []string, err error)
- func (l *LocalDrive) Get(path string) (string, error)
- func (l *LocalDrive) LastModified(path string) (time.Time, error)
- func (l *LocalDrive) Move(from, to string) error
- func (l *LocalDrive) Prepend(path, contents string) error
- func (l *LocalDrive) Put(path, contents string) error
- func (l *LocalDrive) Rename(from, to string) error
- func (l *LocalDrive) Size(path string) (int64, error)
- type LocalDriveConfig
- type Manager
- type PathPrefixer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Drive ¶
type Drive interface { Exists(path string) bool Get(path string) (string, error) Put(path, contents string) error Prepend(path, contents string) error Append(path, contents string) error Delete(path string) error Copy(from, to string) error Move(from, to string) error Rename(from, to string) error Size(path string) (int64, error) LastModified(path string) (time.Time, error) Files(directory string) ([]string, error) AllFiles(directory string) ([]string, error) }
func NewLocalDrive ¶
func NewLocalDrive(config *LocalDriveConfig) Drive
NewLocalDrive creates a new local filesystem drive.
type LocalDrive ¶
type LocalDrive struct {
// contains filtered or unexported fields
}
LocalDrive is a local filesystem drive.
func (*LocalDrive) AllFiles ¶
func (l *LocalDrive) AllFiles(directory string) (files []string, err error)
func (*LocalDrive) Append ¶
func (l *LocalDrive) Append(path, contents string) error
func (*LocalDrive) Copy ¶
func (l *LocalDrive) Copy(from, to string) error
func (*LocalDrive) Delete ¶
func (l *LocalDrive) Delete(path string) error
func (*LocalDrive) Exists ¶
func (l *LocalDrive) Exists(path string) bool
Exists checks if the given path exists.
func (*LocalDrive) Get ¶
func (l *LocalDrive) Get(path string) (string, error)
Get returns the contents of the given path.
func (*LocalDrive) LastModified ¶
func (l *LocalDrive) LastModified(path string) (time.Time, error)
func (*LocalDrive) Move ¶
func (l *LocalDrive) Move(from, to string) error
func (*LocalDrive) Prepend ¶
func (l *LocalDrive) Prepend(path, contents string) error
func (*LocalDrive) Put ¶
func (l *LocalDrive) Put(path, contents string) error
Put writes the given data to the given path.
func (*LocalDrive) Rename ¶
func (l *LocalDrive) Rename(from, to string) error
type LocalDriveConfig ¶
type LocalDriveConfig struct {
Root string
}
LocalDriveConfig is the configuration for a local filesystem drive.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
NewManager creates a new filesystem manager
fs := filesystem.NewManager(&filesystem.Config{ Default: "local", Disk: map[string]interface{}{ "local": &filesystem.LocalDriveConfig{ Root: "temp", }, }, }) fmt.Println(fs.Disk("local").Exists("test.txt"))
func (*Manager) CreateLocalDrive ¶
func (m *Manager) CreateLocalDrive(config *LocalDriveConfig) Drive
CreateLocalDrive creates a local filesystem drive
type PathPrefixer ¶
type PathPrefixer struct {
// contains filtered or unexported fields
}
func NewPathPrefixer ¶
func NewPathPrefixer(prefix string) *PathPrefixer
NewPathPrefixer creates a new PathPrefixer.
func (*PathPrefixer) PrefixPath ¶
func (p *PathPrefixer) PrefixPath(path string) string
PrefixPath Returns a prefixed directory
Click to show internal directories.
Click to hide internal directories.