An open API service indexing awesome lists of open source software.

https://github.com/jiawei397/oak_compress

oak middleware, support br, gzip and deflate
https://github.com/jiawei397/oak_compress

br brotli deflate deno gzip oak

Last synced: about 2 months ago
JSON representation

oak middleware, support br, gzip and deflate

Awesome Lists containing this project

README

        

# oak_compress

[![Deno](https://github.com/jiawei397/oak_compress/actions/workflows/deno.yml/badge.svg)](https://github.com/jiawei397/oak_compress/actions/workflows/deno.yml)

A simple and opinionated `deflate`、`brotli` and `gzip` compress middleware for
Deno [oak](https://deno.land/x/oak).

## Example

```typescript
import {
brotli,
deflate,
gzip,
} from "https://deno.land/x/[email protected]/mod.ts";
import { Application } from "https://deno.land/x/[email protected]/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");
```