2 unstable releases

new 0.2.0 Mar 12, 2025
0.1.0 Dec 29, 2023

#14 in #file-serving

Download history 6/week @ 2024-12-04 13/week @ 2024-12-11 11/week @ 2024-12-18 1/week @ 2024-12-25 6/week @ 2025-01-01 20/week @ 2025-01-08 104/week @ 2025-01-29 33/week @ 2025-02-05 47/week @ 2025-02-12 53/week @ 2025-02-19 28/week @ 2025-02-26 15/week @ 2025-03-05

143 downloads per month
Used in xitca-web

Apache-2.0

33KB
729 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–12MB
~112K SLoC