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
- Host: GitHub
- URL: https://github.com/jiawei397/oak_compress
- Owner: jiawei397
- License: mit
- Created: 2022-05-06T10:38:03.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-05-09T08:30:57.000Z (about 3 years ago)
- Last Synced: 2025-03-07T09:48:20.363Z (2 months ago)
- Topics: br, brotli, deflate, deno, gzip, oak
- Language: TypeScript
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# oak_compress
[](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");
```