filesystem

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package filesystem contains shared manifest and route helpers for file browser plugins backed by different remote filesystem protocols.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilesTab

func FilesTab(prefix string, opts ...FilesOption) plugin.Panel

func Routes

func Routes(prefix, protocol string) []plugin.Route

Types

type Chmodder

type Chmodder interface {
	Chmod(ctx context.Context, p string, mode fs.FileMode) error
}

Chmodder changes a path's permission bits.

type Client

type Client interface {
	Home(ctx context.Context) (string, error)
	ReadDir(ctx context.Context, p string) ([]os.FileInfo, error)
	Stat(ctx context.Context, p string) (os.FileInfo, error)
	Open(ctx context.Context, p string) (io.ReadCloser, error)
	Write(ctx context.Context, p string, r io.Reader) error
	Mkdir(ctx context.Context, p string) error
	Rename(ctx context.Context, from, to string) error
	Remove(ctx context.Context, p string, isDir bool) error
}

type Copier

type Copier interface {
	Copy(ctx context.Context, src, dst string) error
}

Copier duplicates a path within the backend.

type ErrorMapper

type ErrorMapper interface {
	MapError(error) error
}

type FileContent

type FileContent struct {
	Path      string `json:"path"`
	MIME      string `json:"mime,omitempty"`
	Encoding  string `json:"encoding,omitempty"`
	Content   string `json:"content,omitempty"`
	Size      int64  `json:"size,omitempty"`
	Truncated bool   `json:"truncated,omitempty"`
}

type FileEntry

type FileEntry struct {
	Name    string    `json:"name"`
	Path    string    `json:"path"`
	IsDir   bool      `json:"isDir"`
	Size    int64     `json:"size,omitempty"`
	MIME    string    `json:"mime,omitempty"`
	ModTime time.Time `json:"modTime,omitzero"`
	Mode    string    `json:"mode,omitempty"`
}

type FilePage

type FilePage struct {
	Items      []FileEntry `json:"items"`
	NextCursor string      `json:"nextCursor"`
	Total      *int        `json:"total,omitempty"`
	Path       string      `json:"path"`
}

type FilesOption

type FilesOption func(*plugin.FileBrowserConfig)

FilesOption opts a FilesTab into the bulk-operation slots a backend supports.

func WithArchive

func WithArchive(prefix string) FilesOption

func WithChmod

func WithChmod(prefix string) FilesOption

func WithCopy

func WithCopy(prefix string) FilesOption

func WithMove

func WithMove(prefix string) FilesOption

WithMove populates the move bulk slot so the renderer surfaces that action. A backend opts in only for ops it implements; sibling options cover copy, chmod, and archive.

type Mover

type Mover interface {
	Move(ctx context.Context, src, dst string) error
}

Mover relocates a path within the backend.

type RangeOpener

type RangeOpener interface {
	OpenRange(ctx context.Context, p string, offset, length int64) (io.ReadCloser, error)
}

RangeOpener is an optional Client capability for backends that read from an offset but cannot seek. length <= 0 means to EOF.

type Seekable

type Seekable interface {
	OpenSeeker(ctx context.Context, p string) (io.ReadSeekCloser, error)
}

Seekable is an optional Client capability: a seekable handle enables full HTTP Range support for downloads/previews.

type Session

type Session interface {
	Filesystem() (Client, error)
}

Jump to

Keyboard shortcuts

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