Documentation ¶
Overview ¶
Package rfs provides a custom http.FileSystem implementation for serving files with placeholders replaced by their corresponding values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(fs http.FileSystem, placeHolder map[string]string, regex bool) http.FileSystem
New creates a new instance of the FileSystem struct with the specified embedded http.FileSystem instance and placeholder map and returns a pointer to it.
Types ¶
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo is a custom implementation of the os.FileInfo interface that allows setting the size of the file.
type FileSystem ¶
type FileSystem struct { http.FileSystem PlaceHolderValues map[string]string // map for placeholder values Regex bool }
FileSystem is a custom struct that embeds the http.FileSystem interface and adds a PlaceHolderValues map for placeholder values
func (*FileSystem) ApplyTemplate ¶
func (f *FileSystem) ApplyTemplate(data []byte) []byte
ApplyTemplate is a method of the FileSystem struct that replaces placeholders in the input data with their corresponding values and returns the modified data If FileSystem.Regex == false replace values by {{key}} = value
func (FileSystem) Open ¶
func (f FileSystem) Open(name string) (http.File, error)
Open is a method of the FileSystem struct that implements the http.FileSystem interface's Open method. It returns a http.File instance representing the requested file with any placeholders in its contents replaced by their corresponding values.