Compress Middleware #

Compress the response body, according to Accept-Encoding request header.

Note: On Cloudflare Workers, response body will be compressed automatically. So, you don’t have to use this middleware for Cloudflare Workers.

Import #

import { Hono } from 'hono'
import { compress } from 'hono/compress'
import { Hono } from 'https://deno.land/x/hono/mod.ts'
import { compress } from 'https://deno.land/x/hono/middleware.ts'

Usage #

const app = new Hono()

app.use('*', compress())
https://github.com/honojs/hono
© Hono developers.
Built with Hugo & Hugo Book Theme - Not Hono :)