1 unstable release

0.1.0 Dec 29, 2023

#21 in #file-serving


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
~106K SLoC