1 unstable release

0.1.0 Dec 29, 2023

#23 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

172 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–11MB
~108K SLoC