fileserver

package module
v0.0.0-...-0e2fb56 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2014 License: MIT Imports: 15 Imported by: 0

README

go-fileserver - Go cached file server

Overview

This is a Go file server equipped with caching feature. See this discussion.

Example

package main

import (
	"log"
	"net/http"

	"github.com/yosssi/go-fileserver"
)

func main() {
	fs := fileserver.New(fileserver.Options{})
	http.Handle("/", fs.Serve(http.Dir("/Users/yoshidakeiji/www")))
	if err := http.ListenAndServe(":8080", nil); err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
}

Documentation

Overview

Package fileserver provides a cache file server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Quit

func Quit(quitC chan<- struct{}, doneC <-chan struct{})

Quit terminates the file server's detection goroutine.

Types

type FileServer

type FileServer interface {
	Serve(root http.FileSystem) http.Handler
	Detect() (chan<- struct{}, <-chan struct{})
}

FileServer is an interface for serving files.

func New

func New(opts Options) FileServer

New creates and returns a file server.

type Options

type Options struct {
	// CheckInterval represents a check interval of
	// the file server's file change detection's process.
	CheckInterval time.Duration
	// IndexPage represents an index page path.
	IndexPage string
}

Options represents options for a file server.

Jump to

Keyboard shortcuts

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