Skip to main content
Deno 2 is finally here 🎉️
Learn more

oak_compress

Deno

A simple and opinionated deflatebrotli and gzip compress middleware for Deno oak.

Example

import {
  brotli,
  deflate,
  gzip,
} from "https://deno.land/x/oak_compress@v0.0.2/mod.ts";
import { Application } from "https://deno.land/x/oak@v10.5.0/mod.ts";

const app = new Application();
app.use(brotli());
// app.use(gzip());
// app.use(deflate());

// other middleware

app.use((ctx) => {
  const str = new Array(100000).fill("Hello World").join("\n");
  ctx.response.body = str;
});

console.log("app started with: http://localhost");
await app.listen(":80");