Documentation ¶
Overview ¶
Package compress provides a middleware for compression via gzip and deflate.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // CompressMinLength is the lower bound for compression. Smaller files // won't be compressed. CompressMinLength = 256 // CompressMaxBuf is the upper bound for buffered compression. Larger files // will be compressed on-the-fly. CompressMaxBuf = 16 * 1024 )
Functions ¶
func New ¶
New wraps a http.Handler and adds compression via gzip or deflate to the response. The Middleware takes care to not compress twice and will only compress known mimetypes. Small responses will be buffered completely and the Content-Length header will be set accordingly. Large responses as well as responses with unknown length will be compressed on the fly.
... log.Fatal(http.ListenAndServe(":8080", compress.New(http.DefaultServeMux)) ...
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.