Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( WORTH_COMPRESSING_CONTENT_TYPES = map[string]struct{}{ mimeconsts.JS_CTYPE: {}, mimeconsts.CSS_CTYPE: {}, mimeconsts.JSON_CTYPE: {}, mimeconsts.HTML_CTYPE: {}, } )
Functions ¶
Types ¶
type FileCompressor ¶
type FileCompressor struct {
// contains filtered or unexported fields
}
A FileCompressor is a stateful file content compressor that uses GZip for compression and caches compressed files.
func NewFileCompressor ¶
func NewFileCompressor() *FileCompressor
func (*FileCompressor) CompressFileContent ¶
func (c *FileCompressor) CompressFileContent(args ContentCompressionParams) (_ io.ReadSeeker, isCompressed bool, _ error)
CompressFile compresses the file content if it's worth it. If the file is compressed the returned reader is not nil and isCompressed is true. Compressed content is cached for later use. An error is returned if .Ctx is done or if there was an error during compression. ContentReader may not be read at all and is never closed.
Click to show internal directories.
Click to hide internal directories.