fileserver

package
v0.0.0-...-172994f Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSampleFiles

func CreateSampleFiles(targetDir string) error

func CurrentBaseURL

func CurrentBaseURL() string

CurrentBaseURL returns the base URL for the globally tracked running file server, if any.

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware logs information about requests

func SecurityMiddleware

func SecurityMiddleware(next http.Handler) http.Handler

SecurityMiddleware adds security headers to responses

Types

type FileServer

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

FileServer handles serving generated images via HTTP

func NewFileServer

func NewFileServer(basePath string) *FileServer

NewFileServer creates a new file server instance

func (*FileServer) GetBasePath

func (fs *FileServer) GetBasePath() string

GetBasePath returns the current base path of the file server

func (*FileServer) GetBaseURL

func (fs *FileServer) GetBaseURL() string

GetBaseURL returns the base URL (including trailing slash) for the active file server instance.

func (*FileServer) GetURL

func (fs *FileServer) GetURL(relativePath string) string

GetURL returns the URL for accessing a specific image

func (*FileServer) Start

func (fs *FileServer) Start() error

Start initializes and starts the file server

func (*FileServer) Stop

func (fs *FileServer) Stop() error

Stop gracefully shuts down the file server

func (*FileServer) UpdateBasePath

func (fs *FileServer) UpdateBasePath(newPath string) error

UpdateBasePath changes the base directory and restarts the server

Jump to

Keyboard shortcuts

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