1 unstable release

0.1.0 Dec 29, 2023

#17 in #file-serving

Download history 51/week @ 2023-12-29 20/week @ 2024-01-05 20/week @ 2024-01-12 56/week @ 2024-01-19 6/week @ 2024-01-26 40/week @ 2024-02-02 47/week @ 2024-02-09 62/week @ 2024-02-16 33/week @ 2024-02-23 58/week @ 2024-03-01 39/week @ 2024-03-08 13/week @ 2024-03-15 36/week @ 2024-03-22 107/week @ 2024-03-29 36/week @ 2024-04-05

201 downloads per month
Used in xitca-web

Apache-2.0

31KB
706 lines

an async static file serving crate

use http::Request;
use http_file::ServeDir;

async fn serve(req: &Request<()>) {
    let dir = ServeDir::new("sample");
    let res = dir.serve(&req).await;
}

Requirement

  • nightly Rust
  • http and futures for http types and async streaming interaction[^1]

[^1]: see project Cargo.toml for dependency versioning.


lib.rs:

local file serving with http.

Dependencies

~3–14MB
~120K SLoC