localfileservice

package
v0.28.13 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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