staticfs

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFastFileSystem added in v0.0.5

func NewFastFileSystem(withOptions ...FastFileSystemOption) (_ http.Handler, err error)

Types

type FS

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

func New

func New(withOptions ...Option) (_ *FS, err error)

func (*FS) ServeHTTP

func (fs *FS) ServeHTTP(
	w http.ResponseWriter,
	r *http.Request,
)

func (*FS) ServeHyperText

func (fs *FS) ServeHyperText(
	w http.ResponseWriter,
	r *http.Request,
) (err error)

func (*FS) String

func (fs *FS) String() string

type FastFile added in v0.1.0

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

func NewFastFileFromTemplate added in v0.1.0

func NewFastFileFromTemplate(t *template.Template, data any) (*FastFile, error)

func NewFastFileSystemFile added in v0.0.5

func NewFastFileSystemFile(contents []byte) *FastFile

NewFastFileSystemFile serves a single file from memory without logging.

func (*FastFile) HandleError added in v0.1.0

func (f *FastFile) HandleError(
	w http.ResponseWriter,
	r *http.Request,
	err error,
) error

func (*FastFile) ServeHTTP added in v0.1.0

func (f *FastFile) ServeHTTP(
	w http.ResponseWriter,
	r *http.Request,
)

type FastFileSystemOption added in v0.0.5

type FastFileSystemOption func(*fastFileSystemOptions) error

func WithDefaultFastFileSystemFallthrough added in v0.0.10

func WithDefaultFastFileSystemFallthrough() FastFileSystemOption

func WithFastFileSystemFallthrough added in v0.0.10

func WithFastFileSystemFallthrough(h http.Handler) FastFileSystemOption

func WithFastFileSystemFile added in v0.0.5

func WithFastFileSystemFile(
	path string,
	contents []byte,
) FastFileSystemOption

type Option

type Option func(*options) error

func WithDirectory

func WithDirectory(p string) Option

func WithFileSystem

func WithFileSystem(fs fs.FS) Option

func WithPath

func WithPath(external, real string) Option

func WithPathTranslators

func WithPathTranslators(ts ...PathTranslator) Option

type PathTranslator

type PathTranslator func(real string) (external string, accept bool, err error)

Jump to

Keyboard shortcuts

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