rclone

package
v0.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented = errors.New("not implemented")
)

Functions

func GetFsFromRcloneLsjsonResult

func GetFsFromRcloneLsjsonResult(lsjsonOutput []byte) (fs.ReadDirFS, error)

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) Close

func (l *LsjsonItem) Close() error

Close implements fs.File.

func (*LsjsonItem) Info

func (l *LsjsonItem) Info() (fs.FileInfo, error)

Info implements fs.DirEntry.

func (*LsjsonItem) IsDir

func (l *LsjsonItem) IsDir() bool

IsDir implements fs.DirEntry.

func (*LsjsonItem) ModTime

func (l *LsjsonItem) ModTime() time.Time

ModTime implements fs.FileInfo.

func (*LsjsonItem) Mode

func (l *LsjsonItem) Mode() (fm fs.FileMode)

Mode implements fs.FileInfo.

func (*LsjsonItem) Name

func (l *LsjsonItem) Name() string

Name implements fs.DirEntry.

func (*LsjsonItem) Open

func (l *LsjsonItem) Open(name string) (fs.File, error)

Open implements fs.ReadDirFS.

func (*LsjsonItem) Read

func (l *LsjsonItem) Read([]byte) (int, error)

Read implements fs.File.

func (*LsjsonItem) ReadDir

func (l *LsjsonItem) ReadDir(name string) (entries []fs.DirEntry, err error)

ReadDir implements fs.ReadDirFS.

func (*LsjsonItem) Size

func (l *LsjsonItem) Size() int64

Size implements fs.FileInfo.

func (*LsjsonItem) Stat

func (l *LsjsonItem) Stat() (fs.FileInfo, error)

Stat implements fs.File.

func (*LsjsonItem) Sys

func (l *LsjsonItem) Sys() any

Sys implements fs.FileInfo.

func (*LsjsonItem) Type

func (l *LsjsonItem) Type() fs.FileMode

Type implements fs.DirEntry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL