filer

package module
v0.0.0-...-f9f7fcc Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2015 License: MIT Imports: 8 Imported by: 0

README

filer

Filer implements a static file server in Golang.

Install

go get github.com/nwolber/filer

Documentation

Overview

Package filer contains a simple HTTP server for static resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asseter

type Asseter interface {
	IsDir(name string) (bool, error)
	Asset(name string) (io.ReadCloser, error)
}

An Asseter resolves resources by name.

type Filer

type Filer struct {
	http.FileSystem
}

A Filer serves static resources.

func New

func New(fs http.FileSystem) (*Filer, error)

New creates a new filer which uses the Asseter to retrieve assets.

func (*Filer) ServeHTTP

func (f *Filer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP returns files from the file system. The file has to be located in the directory configured to the static server or a subdirectory. HTTP errors are raised if the requested file does not exist or another error occured.

Jump to

Keyboard shortcuts

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