filemanager

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRangeHeader

func ParseRangeHeader(rangeHeader string, fileSize int64) (start, end int64, err error)

Types

type DownloadOptions

type DownloadOptions struct {
	Path       string
	RangeStart int64
	RangeEnd   int64
}

type FileInfo

type FileInfo struct {
	Name        string      `json:"name"`
	Path        string      `json:"path"`
	Size        int64       `json:"size"`
	Mode        os.FileMode `json:"mode"`
	ModTime     time.Time   `json:"mod_time"`
	IsDir       bool        `json:"is_dir"`
	IsSymlink   bool        `json:"is_symlink"`
	Owner       uint32      `json:"owner,omitempty"`
	Group       uint32      `json:"group,omitempty"`
	Permissions string      `json:"permissions"`
	MimeType    string      `json:"mime_type,omitempty"`
}

type ListOptions

type ListOptions struct {
	Path      string
	Recursive bool
	Offset    int
	Limit     int
	SortBy    string
	SortOrder string
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func New

func New(allowedPaths []string, auditLogger *audit.Logger) *Manager

func (*Manager) Copy

func (m *Manager) Copy(ctx context.Context, srcPath, dstPath string, user string) error

func (*Manager) CreateDir

func (m *Manager) CreateDir(ctx context.Context, path string, user string) error
func (m *Manager) CreateHardlink(ctx context.Context, target, linkPath string, user string) error
func (m *Manager) CreateSymlink(ctx context.Context, target, linkPath string, user string) error

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context, path string, user string) error

func (*Manager) Download

func (m *Manager) Download(ctx context.Context, writer io.Writer, opts DownloadOptions, user string) (int64, error)

func (*Manager) GetChecksum

func (m *Manager) GetChecksum(ctx context.Context, path string, user string) (string, error)

func (*Manager) GetInfo

func (m *Manager) GetInfo(ctx context.Context, path string, user string) (*FileInfo, error)

func (*Manager) List

func (m *Manager) List(ctx context.Context, opts ListOptions, user string) ([]FileInfo, error)

func (*Manager) Move

func (m *Manager) Move(ctx context.Context, srcPath, dstPath string, user string) error

func (*Manager) Rename

func (m *Manager) Rename(ctx context.Context, oldPath, newPath string, user string) error

func (*Manager) Upload

func (m *Manager) Upload(ctx context.Context, reader io.Reader, opts UploadOptions, user string) error

type PathValidator

type PathValidator struct {
	// contains filtered or unexported fields
}

func NewPathValidator

func NewPathValidator(allowedPaths []string) *PathValidator

func (*PathValidator) ValidateName

func (v *PathValidator) ValidateName(name string) error

func (*PathValidator) ValidatePath

func (v *PathValidator) ValidatePath(path string) error

type UploadOptions

type UploadOptions struct {
	Path          string
	TempDir       string
	MaxSize       int64
	ChunkSize     int64
	ResumeSupport bool
}

Jump to

Keyboard shortcuts

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