#iron #send-file #range #header #serve #path #request

iron-send-file

Serve files with Range header support for Iron library

2 releases

Uses old Rust 2015

0.1.1 Oct 2, 2016
0.1.0 Oct 2, 2016

#14 in #send-file

MIT license

5KB
74 lines

iron-send-file

Serve files with Range header support for Iron library.

Example

extern crate iron;
extern crate iron_send_file;

use std::path::Path;
use iron::prelude::*;
use iron_send_file::send_file;

fn main() {
    Iron::new(|req: &mut Request| {
            let path = Path::new("src/main.rs");

            let res = Response::new();

            send_file(req, res, path)
        })
        .http("localhost:3000")
        .unwrap();
}
$ curl http://localhost:3000 -H "Range: bytes=0-5"
extern

Author

Luka Zakrajšek

License

MIT


lib.rs:

iron-send-file

Serve files with Range header support for Iron library.

Dependencies

~5MB
~116K SLoC