static

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(urlPrefix string, fs ServeFileSystem) gin.HandlerFunc

Serve returns a middleware handler that serves static files in the provided filesystem.

func ServeRoot

func ServeRoot(urlPrefix, root string) gin.HandlerFunc

ServeRoot returns a middleware handler that serves from a filesystem directory.

Types

type HTTPFileSystem

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

HTTPFileSystem wraps around http.FileSystem.

func FileSystem

func FileSystem(fs http.FileSystem) *HTTPFileSystem

FileSystem returns an HTTPFileSystem.

func (*HTTPFileSystem) Exists

func (instance *HTTPFileSystem) Exists(prefix string, filepath string) bool

Exists returns if a path exists or not.

func (*HTTPFileSystem) Open

func (instance *HTTPFileSystem) Open(name string) (http.File, error)

Open opens a file.

type LocalFileSystem

type LocalFileSystem struct {
	http.FileSystem
	// contains filtered or unexported fields
}

LocalFileSystem represents a local file system.

func LocalFile

func LocalFile(root string, indexes bool) *LocalFileSystem

LocalFile returns an instance of a LocalFileSystem serving from a specified directory.

func (*LocalFileSystem) Exists

func (l *LocalFileSystem) Exists(prefix string, filepath string) bool

Exists returns if a path exists.

type ServeFileSystem

type ServeFileSystem interface {
	http.FileSystem
	Exists(prefix string, path string) bool
}

ServeFileSystem represents a static filesystem that can be served.

Jump to

Keyboard shortcuts

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