magicdir

package
v0.0.0-...-bb8d682 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MagicFileNames

type MagicFileNames []string

MagicFileNames holds a list (a []string) of "magic" files-names.

These, for example, could be the "magic" file-names that are looked for when a web-server is trying to provide a response for a request for a directory.

For example:

var magicFileNames libdir.MagicFileNames = lib.MagicFileNames{
	"default.html",
	"default.xhtml",
	"index.html",
	"index.xhtml",
	"README.md",
}

These are used in its [Match] method.

func (MagicFileNames) Match

func (receiver MagicFileNames) Match(dirEntries ...fs.DirEntry) (string, bool)

The `dirEntries` passed to Match are the fs.DirEntry of the files in a directory.

Match looks through that list of fs.DirEntry (`fileNames`) and looks for the "magic" file-names in its receiver.

The "magic" file-names in the receiver are in priority order. With the first one being the highest priority.

Jump to

Keyboard shortcuts

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