staticfiles: bou.ke/staticfiles/files Index | Files

package files

import "bou.ke/staticfiles/files"

Index

Package Files

files.go

Variables

var NotFound = http.NotFound

NotFound is called when no asset is found. It defaults to http.NotFound but can be overwritten

var Server http.Handler = http.HandlerFunc(ServeHTTP)

Server is simply ServeHTTP but wrapped in http.HandlerFunc so it can be passed into net/http functions directly.

func Hash Uses

func Hash(file string) (s string)

Hash returns the hex-encoded SHA256 hash of the original file Used for the Etag, and useful for caching Returns an empty string if the file is not in the bundle

func ModTime Uses

func ModTime(file string) (t time.Time)

ModTime returns the modification time of the original file. Useful for caching purposes Returns zero time if the file is not in the bundle

func Open Uses

func Open(name string) (io.ReadCloser, error)

Open allows you to read an embedded file directly. It will return a decompressing Reader if the file is embedded in compressed format. You should close the Reader after you're done with it.

func ServeHTTP Uses

func ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP serves a request, attempting to reply with an embedded file.

Package files imports 8 packages (graph) and is imported by 1 packages. Updated 2019-03-03. Refresh now. Tools for package owners.