Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompressedAsset ¶
type CompressedAsset[Reader io.Reader] struct { MIMEType string Compression Compression // contains filtered or unexported fields }
CompressedAsset is an open reader that can read possibly compressed data.
func NewCompressedAssetReader ¶
func NewCompressedAssetReader[Reader io.Reader](r Reader, compression Compression, mimeType string) CompressedAsset[Reader]
NewCompressedAssetReader creates a new compressed asset reader.
func (CompressedAsset[Reader]) Close ¶
func (c CompressedAsset[Reader]) Close() error
Close closes the underlying reader. If Reader is not derived from io.Closer, then this method does nothing.
func (CompressedAsset[Reader]) CompressedReader ¶
func (c CompressedAsset[Reader]) CompressedReader() io.Reader
CompressedReader returns the underlying compressed reader. This reader reads possibly compressed data.
func (CompressedAsset[Reader]) WriteToResponse ¶
func (c CompressedAsset[Reader]) WriteToResponse(w http.ResponseWriter) error
WriteToResponse writes the compressed data to an HTTP response. This sets the appropriate headers and writes the compressed data.
type Compression ¶
type Compression string
Compression is the type of compression used for an asset.
const ( NotCompressed Compression = "" GzipCompression Compression = "gzip" ZstdCompression Compression = "zstd" BrotliCompression Compression = "brotli" )
Click to show internal directories.
Click to hide internal directories.