Documentation
¶
Index ¶
- type FileWrapper
- func (instance *FileWrapper) MkDir() error
- func (instance *FileWrapper) Read() (response []byte, err error)
- func (instance *FileWrapper) ReadDir() (response []*FileWrapper, err error)
- func (instance *FileWrapper) Remove() error
- func (instance *FileWrapper) SetTag(tag string) *FileWrapper
- func (instance *FileWrapper) SetUid(uid string) *FileWrapper
- func (instance *FileWrapper) String() string
- func (instance *FileWrapper) Write(bytes []byte) (size int, err error)
- type FsHelper
- func (instance *FsHelper) Exists(path string) (bool, error)
- func (instance *FsHelper) MkDir(path string) error
- func (instance *FsHelper) Read(filename string) (response []byte, err error)
- func (instance *FsHelper) ReadDir(path string) (response []*FileWrapper, err error)
- func (instance *FsHelper) Remove(source string) error
- func (instance *FsHelper) Wrap(filename string) *FileWrapper
- func (instance *FsHelper) Write(data []byte, target string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileWrapper ¶
type FileWrapper struct {
Uid string `json:"uid"` // unique ID based on full-path
Tag string `json:"tag"` // file, dir
Path string `json:"path"` // full-path
Name string `json:"name"` // file name, file.txt
Ext string `json:"ext"` // extension. .txt
IsDir bool `json:"is_dir"`
Size int64 `json:"size"`
Mode string `json:"mode"`
ModTime int64 `json:"mod_time"`
Bytes []byte `json:"bytes"`
Hash string `json:"hash"`
}
FileWrapper represents a wrapper structure for file system entities with metadata and utility methods. Works both for files and dirs
func NewFileWrapper ¶
func NewFileWrapper(filename string) (instance *FileWrapper)
NewFileWrapper creates a new FileWrapper instance for the specified filename without reading file contents.
func (*FileWrapper) MkDir ¶
func (instance *FileWrapper) MkDir() error
func (*FileWrapper) Read ¶
func (instance *FileWrapper) Read() (response []byte, err error)
func (*FileWrapper) ReadDir ¶
func (instance *FileWrapper) ReadDir() (response []*FileWrapper, err error)
func (*FileWrapper) Remove ¶
func (instance *FileWrapper) Remove() error
func (*FileWrapper) SetTag ¶ added in v0.2.101
func (instance *FileWrapper) SetTag(tag string) *FileWrapper
func (*FileWrapper) SetUid ¶ added in v0.2.101
func (instance *FileWrapper) SetUid(uid string) *FileWrapper
func (*FileWrapper) String ¶
func (instance *FileWrapper) String() string
Click to show internal directories.
Click to hide internal directories.