fsdefault

package module
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: 7 Imported by: 0

README

go-fsdefault

Package fsdefault provides tools for seeing if an fs.File directory contains a default-file, for the Go programming language.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-fsdefault

GoDoc

Import

To import package fsdefault use import code like the following:

import "codeberg.org/reiver/go-fsdefault"

Installation

To install package fsdefault do the following:

GOPROXY=direct go get codeberg.org/reiver/go-fsdefault

Author

Package fsdefault was written by Charles Iliya Krempeaux

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(filesys fs.FS, fileNames ...string) fs.FS

Wrap is an fs.FS "middleware" that wraps an fs.FS with a defaulting-file-system.

With a defaulting-file-system, there is a list of default-file-names. For example:

[]string{"default.html","default.xhtml","index.html","index.xhtml","README.md"}

This is a priortized list. With names earlier in the list having a higher priority.

And then, if the path given to the Open №1 ends in a "/", and №2 is a directory, and №3 the fs.File either implements fsdir.DirReaderAll or fs.ReadDirFile, and №4 the directory (directly) contains a file with one of the default-file-names, then that matching default-file-name is returned.

If more there is more than one match, then the highest priority one is returned.

func WrapWithLogger

func WrapWithLogger(logger log.Logger, filesys fs.FS, fileNames ...string) fs.FS

WrapWithLogger is similar to Wrap except a log.Logger can be injected into it.

Types

This section is empty.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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