Home

Awesome

<div align="center">

http_compression

nest badge GitHub Workflow Status Codecov

</div>

Deno HTTP compression middleware.

Features

Example

import { compression } from 'https://deno.land/x/http_compression/mod.ts'
import { Server } from 'https://deno.land/http/server.ts'

const s = new Server({
  handler: async (req) => {
    return await compression({
      path: 'README.md',
      compression: ['br', 'gzip', 'deflate'],
    })(req)
  },
  addr: ':3000',
})

s.listenAndServe()

Now try to send a HEAD request with curl:

$ curl localhost:3000 --head -H "Accept-Encoding: br, gzip, deflate" --compressed
HTTP/1.1 200 OK
content-length: 550
content-encoding: br, gzip, deflate