Middleware to add gzip/brotli compression to HTTP microservices built with the Micro framework (from ZEIT/Now). Version 1.0.0 is stable and wraps the popular compression npm package, passing all options through. It is designed specifically for Micro's async request handler pattern, not Express or other frameworks. The package is minimal (no dependencies beyond compression and micro) and follows the same promise-based flow as Micro itself. It is released under MIT license and has not seen updates since 2017, indicating maintenance status.
npm install micro-compressVerified import paths — ran on the pinned version, not inferred.
Wraps a Micro request handler with compression middleware. The handler remains async, and the response is gzip-compressed if accepted.
Use compression middleware designed for your framework (e.g., compression for Express).
Use require('micro-compress') instead of import. If you need ESM, transpile or use dynamic import.Pass options as first argument: compress({level: 9}, handler). Do not pass handler as first argument.If brotli needed, ensure compression@>=1.7.0 is installed and pass { brotli: { enabled: true } }. Check compression docs.Run npm install micro-compress in the project root.
Use const compress = require('micro-compress');Ensure micro is installed: npm install micro. Then wrap: compress(handler) or compress(options, handler).