static

package
v1.9.14 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 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 given directory.

func ServeRoot

func ServeRoot(urlPrefix, root string) gin.HandlerFunc

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

Types

type HTTPFileSystem added in v1.9.6

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 added in v1.9.6

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

Exists returns if a path exists or not.

func (*HTTPFileSystem) Open added in v1.9.6

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

Open opens a file.

type LocalFileSystem added in v1.9.6

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 added in v1.9.6

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