package dream-encoding

  1. Overview
  2. Docs
Encoding primitives for Dream

Install

Dune Dependency

Authors

Maintainers

Sources

dream-encoding-0.1.0.tbz
sha256=cb0bc45567f3297c7610e56689333dafc51f30592fe8c15ab9024ce0e6adaf9d
sha512=2b156e39a5b32ef04b069af30a3b1f3ff76f6bc7ccde68b1cb5878616d0b1a8440daf096e3500dd1dabcd1688bd06fa29193dfe0dfb34627dca67f436168af81

Description

Encoding primitives for Dream.

Published: 30 Jun 2021

README

Dream Encoding

Encoding primitives for Dream.

Usage

The most common usage is to add the Dream_encoding.compress middleware to your Dream application:

let () =
  Dream.run ~debug:true
  @@ Dream.logger
  @@ Dream_encoding.compress
  @@ Dream.router [ Dream.get "/" (fun _ -> Dream.html "Hello World!") ]
  @@ Dream.not_found

The middleware will parse the Accept-Encoding header from the requests and compress the responses accordingly.

The library API also includes other lower-level functions for convenience, and are documented here.

Limitation

As of now, the only supported encoding directives are gzip and deflate.

Support for more compression methods will come when they are supported in decompress, the underlying compression library used in dream-encoding.

To Do

  • [ ] Support Brotli compression (see https://github.com/mirage/decompress/issues/101)

Dependencies (4)

  1. decompress >= "1.4.1"
  2. dream < "1.0.0~alpha3"
  3. dune >= "2.0"
  4. ocaml >= "4.08.0"

Dev Dependencies (1)

  1. odoc with-doc

Used by

None

Conflicts (1)

  1. result < "1.5"