localfileservice

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MaxWriteSize = 10 * 1024 * 1024

Variables

View Source
var ErrInvalidPath = errors.New("invalid local path")

Functions

func NormalizeRelPath

func NormalizeRelPath(raw string, allowRoot bool) (string, error)

Types

type Entry

type Entry struct {
	Path        string    `json:"path"`
	Name        string    `json:"name"`
	ContentType string    `json:"contentType,omitempty"`
	Size        int64     `json:"size"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
	IsDirectory bool      `json:"isDirectory"`
}

type Service

type Service interface {
	Root() string
	List(ctx context.Context, relPath string) ([]Entry, error)
	Stat(ctx context.Context, relPath string) (*Entry, error)
	Read(ctx context.Context, relPath string) ([]byte, *Entry, error)
	Write(ctx context.Context, relPath string, data []byte, createOnly bool) (*Entry, error)
	Mkdir(ctx context.Context, relPath string) (*Entry, error)
	Delete(ctx context.Context, relPath string) error
	Move(ctx context.Context, fromPath, toPath string) (*Entry, error)
}

func New

func New(root string) (Service, error)

Jump to

Keyboard shortcuts

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