Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileServer ¶
func FileServer(root http.FileSystem) http.Handler
FileServer is a drop-in replacement for Go's standard http.FileServer which adds support for static resources precompressed with gzip, at the cost of removing the support for directory browsing.
If file filename.ext has a compressed version filename.ext.gz alongside it, if the client indicates that it accepts gzip-compressed data, and if the .gz file can be opened, then the compressed version of the file will be sent to the client. Otherwise the request is passed on to http.ServeContent, and the raw (uncompressed) version is used.
It is up to you to ensure that the compressed and uncompressed versions of files match and have sensible timestamps.
Compressed or not, requests are fulfilled using http.ServeContent, and details like accept ranges and content-type sniffing are handled by that method.
Types ¶
This section is empty.