shelf_gzip library
shelf
support for gzip
encoding responses.
Properties
- gzipMiddleware → Middleware
-
The default
gzip
encodingMiddleware
.final
Functions
-
acceptsGzipEncoding(
Request request) → bool -
Returns
true
if the request acceptsgzip
encoding. -
canGzipEncodeResponse(
Response response, {int minimalGzipContentLength = _defaultMinimalGzipContentLength, _AlreadyCompressedContentType? alreadyCompressedContentType}) → bool -
Returns
true
ifresponse
can be compressed. -
createGzipMiddleware(
{int minimalGzipContentLength = _defaultMinimalGzipContentLength, _AlreadyCompressedContentType? alreadyCompressedContentType, int compressionLevel = _defaultGzipCompressionLevel, bool addCompressionRatioHeader = true, bool addServerTiming = false, String serverTimingEntryName = 'gzip'}) → Middleware -
Converts a
Response
to agzip
encoding (only if theRequest
acceptsGzipEncoding). -
gzipEncodeResponse(
Response response, {int minimalGzipContentLength = _defaultMinimalGzipContentLength, _AlreadyCompressedContentType? alreadyCompressedContentType, int compressionLevel = _defaultGzipCompressionLevel, bool addCompressionRatioHeader = true, bool addServerTiming = false, String serverTimingEntryName = 'gzip'}) → FutureOr< Response> -
Converts
response
to agzip
encoding response. Checks canGzipEncodeResponse. -
isAlreadyCompressedContentType(
String contentType) → bool -
Returns
true
ifcontentType
is already compressed. -
isAlreadyCompressedExtension(
String extension) → bool