rocket_seek_stream 0.2.1

Rocket-rs responder to range requests using types that implement Read + Seek
# rocket_seek_stream

A [Rocket]( responder for types implementing the `Read + Seek` traits, such as files and `std::io::Cursor`, that will respond to range requests with a 206 Partial Content response. The `Content-Type` can optionally be inferred by taking a sample of bytes from the beginning of the stream, or given manually. An `Accept-Ranges: bytes` header will be sent in all responses to notify browsers that range requests are supported for the resource.

This supports both single and multipart/byterange requests.

## Cargo.toml
Add this to your dependencies.

rocket_seek_stream = {git=""}

## Examples
Serving a file from the disk

#![feature(proc_macro_hygiene, decl_macro)]
extern crate rocket;
use rocket_seek_stream::SeekStream;

fn home<'a>() -> std::io::Result<SeekStream<'a>> {
fn main() {
    .mount("/", routes![home])

Serving an in memory buffer
fn cursor<'a>() -> SeekStream<'a> {
    let bytes = &include_bytes!("./fly_me_to_the_moon.webm")[..];
    let len = bytes.len();
    let stream = std::io::Cursor::new(bytes);

    SeekStream::with_opts(stream, len as u64, "video/webm")

Use `cargo run --example server` to run the example. run `examples/` to download the media it depends on using [youtube-dl](