#iron #hyper #hyper-http #http

iron_compress

A modifier for Iron that can compress response bodies

4 releases

Uses old Rust 2015

0.1.3 Feb 4, 2017
0.1.2 Jan 11, 2017
0.1.1 Jul 7, 2016
0.1.0 Jun 6, 2016

#576 in Compression

MIT license

3KB

compress

Build Status

This small library exposes two types that know how to encode bytes based on the GZIP and deflate algorithms. The types implement the modifier trait so they can be used in an Iron Response.

Documentation

Find it here

Example

extern crate iron;
extern crate iron_compress;

use iron::prelude::*;
use iron::status;

use iron_compress::GzipWriter;

fn main() {
    fn hello_world(_: &mut Request) -> IronResult<Response> {
        Ok(Response::with((status::Ok, GzipWriter(b"Some compressed response"))))
    }

    Iron::new(hello_world).http("localhost:3000").unwrap();
}

License

MIT

Dependencies

~5.5MB
~127K SLoC