files

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package files implements the tailkitd files integration:

POST /files        — receive a file written atomically to the node
GET  /files?path=  — read a single file (JSON wrapper or raw bytes)
GET  /files?dir=   — list a directory

Both reads and writes are gated by files.toml configuration. Path traversal is checked on every operation before any filesystem I/O.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler serves GET and POST /files.

func NewHandler

func NewHandler(cfg Tailkittypes.FilesConfig, reg *exec.Registry, jobs *exec.JobStore, logger *zap.Logger) *Handler

NewHandler constructs a files Handler. If cfg.Enabled is false the handler responds 503 to all requests.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux)

Register mounts the files endpoints onto mux.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP dispatches on HTTP method.

POST /files                          — write a file to the node
GET  /files/config                    — get the files config
GET  /files?path=                     — read a single file (JSON wrapper or raw bytes)
GET  /files?path=?stat=true          — read a single file and return the file state
GET  /files?dir=                      — list a directory

Jump to

Keyboard shortcuts

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