shelf_gzip
4.1.0, released 3 years ago by jpryan.me
Shelf middleware to GZIP encode HTTP responses.
What it does
Shelf middleware that automatically applies GZIP compression to HTTP responses based on content type and compression level. It skips compression for already compressed content types or small response bodies.
AI-written summary of version 4.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building a Dart backend using the shelf package and want to compress responses.
- You want to optimize bandwidth usage for text or code content served by your shelf server.
Skip it when
- You are not using the shelf package for your backend.
- Response bodies are consistently smaller than 512 bytes and will not benefit from compression.
Strengths
- Easy integration with shelf pipelines via gzipMiddleware.
- Allows customization of compression level and compression scope.
- Automatically skips already compressed content types.
Weaknesses
- Limited to the shelf ecosystem.
- Not documented for non-shelf frameworks.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Not documented
var handler = const shelf.Pipeline().addMiddleware(gzipMiddleware).addHandler(staticHandler);Alternatives
Packages that do the same job and could replace shelf_gzip.
- shelf_cors_headers
CORS headers middleware for Shelf.
47Compare
Works with
Packages commonly used together with shelf_gzip: ones it builds on, ones built on it, and its own family.
- shelfshelf_gzip depends on itComposable web server middleware for Dart
- jasprBuilt on shelf_gzipA web framework for building websites in Dart with Flutter-like syntax and server-side rendering.
- bones_apiBuilt on shelf_gzipA powerful API backend framework for Dart with HTTP server, routing, SQL translator, and DB adapters.
- release_updaterBuilt on shelf_gzipAutomatically update release and installation files in a local directory.
- shelf_easyBuilt on shelf_gzipLightweight framework with a JSON model generator, database operator, and web/WebSocket server/client.