Documentation
¶
Index ¶
- Variables
- func GetFsFromRcloneLsjsonResult(lsjsonOutput []byte) (fs.ReadDirFS, error)
- type LsjsonItem
- func (l *LsjsonItem) Close() error
- func (l *LsjsonItem) Info() (fs.FileInfo, error)
- func (l *LsjsonItem) IsDir() bool
- func (l *LsjsonItem) ModTime() time.Time
- func (l *LsjsonItem) Mode() (fm fs.FileMode)
- func (l *LsjsonItem) Name() string
- func (l *LsjsonItem) Open(name string) (fs.File, error)
- func (l *LsjsonItem) Read([]byte) (int, error)
- func (l *LsjsonItem) ReadDir(name string) (entries []fs.DirEntry, err error)
- func (l *LsjsonItem) Size() int64
- func (l *LsjsonItem) Stat() (fs.FileInfo, error)
- func (l *LsjsonItem) Sys() any
- func (l *LsjsonItem) Type() fs.FileMode
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotImplemented = errors.New("not implemented")
)
Functions ¶
func GetFsFromRcloneLsjsonResult ¶
Get a (virtual) fs.ReadDirFS from the json file that is outputed by "rclone lsjson" (https://rclone.org/commands/rclone_lsjson/). It's expected to be the output of "rclone lsjson --recursive remote:<root_path>". "rclone lsjson" output a flatten list of all items in specified path, possibly recursivly, in no order (however, parent dir item are guaranteed to be before child items).
Types ¶
type LsjsonItem ¶
type LsjsonItem struct {
ItemIsDir bool `json:"IsDir,omitempty"`
ItemModTime string `json:"ModTime,omitempty"` // "2017-05-31T16:15:57.034468261+01:00"
ItemName string `json:"Name,omitempty"` // "file.txt"
Path string `json:"Path,omitempty"` //"full/path/file.txt". Relative to <root_path>
ItemSize int64 `json:"Size,omitempty"`
// contains filtered or unexported fields
}
The format of each item that "rclone lsjson <root_path>" output. See https://rclone.org/commands/rclone_lsjson/ . Some fields that rclone outputs are commented out as ptool does NOT use them. *LsjsonItem implements: fs.DirEntry, fs.FileInfo, fs.ReadDirFS, fs.File. The fs.File implementation only supports Stat() action. Some json field names (e.g. "Size") are used by DirEntry / FileInfo /... interfaces, so they are renamed to with "Item" prefix.
func (*LsjsonItem) Info ¶
func (l *LsjsonItem) Info() (fs.FileInfo, error)
Info implements fs.DirEntry.
func (*LsjsonItem) ModTime ¶
func (l *LsjsonItem) ModTime() time.Time
ModTime implements fs.FileInfo.
func (*LsjsonItem) Open ¶
func (l *LsjsonItem) Open(name string) (fs.File, error)
Open implements fs.ReadDirFS.