// use actix_files as fs; use actix_web::http::header::{ContentDisposition, DispositionType}; use actix_web::{web, App, Error, HttpRequest, HttpServer}; async fn index(req: HttpRequest) -> Result { let path: std::path::PathBuf = req.match_info().query("filename").parse().unwrap(); let file = fs::NamedFile::open(path)?; Ok(file .use_last_modified(true) .set_content_disposition(ContentDisposition { disposition: DispositionType::Attachment, parameters: vec![], })) } #[actix_rt::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| App::new().route("/{filename:.*}", web::get().to(index))) .bind("127.0.0.1:8088")? .run() .await } //