mini-static 0.5.0

A secure, async static file server with streaming, traversal protection, and connection limits.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use bytes::Bytes;
use http_body_util::BodyExt;
use hyper::Response;
use mini_static::ResponseBody;

pub async fn body_bytes(response: Response<ResponseBody>) -> Bytes {
    response
        .into_body()
        .collect()
        .await
        .expect("body collection is infallible")
        .to_bytes()
}