diskfs

package
v0.16.397 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 18 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

Overview

Package diskfs serves the Disk tab's file routes (/api/fs/*): the roots a deployment names, a listing, the favorite folders, a download, a new folder and resumable uploads. Everything is relative to a root; a path never leaves its root, neither by "..", nor by an absolute path, nor by a symbolic link.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Roots []Root
	// StateDir keeps the favorites and the unfinished uploads (the latter under disk-uploads/).
	StateDir string
	// ChunkSize is how many bytes one PUT of an upload may carry; 0 is 8 MiB.
	ChunkSize int64
}

Config is what a deployment sets: the roots, and where the server keeps its own state.

type Root

type Root struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	Path  string `json:"path"`
}

Root is one folder of the machine the Disk tab may open.

func ParseRoots

func ParseRoots(spec string) ([]Root, error)

ParseRoots reads "Label=/abs/path;Other=/abs/other". The id of a root is its label as a slug.

type Server

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

Server answers the routes. Make it with New.

func New

func New(cfg Config) *Server

New is a server for the roots; nil when there are none (the feature is off).

func (*Server) Serve

func (s *Server) Serve(w http.ResponseWriter, r *http.Request, sub []string)

Serve answers one request; sub is the path after /api/fs.

Jump to

Keyboard shortcuts

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