fsbrowse

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: MIT Imports: 10 Imported by: 1

README

fsbrowse Build

Screenshot

A Go module that provides a web UI to browse an fs.FS. Effectively a slightly nicer-looking version of http.FileServer.

Requires Go 1.16 or newer, due to the usage of fs.FS. Also, the fs.FS being used must implement io.Seeker and fs.ReadDirFile on its files.

Usage

The module exports one function, FileServer, which accepts an fs.FS and returns an http.Handler. Here's an example of how you might use this in practice:

root := os.DirFS("./some/path/somewhere")
http.ListenAndServe(":9876", fsbrowse.FileServer(root))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileServer

func FileServer(root fs.FS) http.Handler

func FileServerWithOptions

func FileServerWithOptions(root fs.FS, options Options) http.Handler

func ServeHTTPStateless

func ServeHTTPStateless(w http.ResponseWriter, r *http.Request, root fs.FS, prefix string, notice string)

Types

type Options

type Options struct {
	Prefix string
	Notice string
}

Jump to

Keyboard shortcuts

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