#actix #actix-web #multipart-formdata #multipart-uploads

actix-easy-multipart

Typed multipart form extractor for actix-web

8 releases (5 stable)

3.0.0 Nov 5, 2022
2.1.1 Apr 30, 2022
2.0.0 Mar 28, 2022
2.0.0-beta.1 Jan 27, 2022
0.1.1 Jan 15, 2022

#439 in HTTP server

Download history 63/week @ 2023-10-25 96/week @ 2023-11-01 66/week @ 2023-11-08 125/week @ 2023-11-15 113/week @ 2023-11-22 131/week @ 2023-11-29 56/week @ 2023-12-06 94/week @ 2023-12-13 123/week @ 2023-12-20 71/week @ 2023-12-27 155/week @ 2024-01-03 76/week @ 2024-01-10 103/week @ 2024-01-17 91/week @ 2024-01-24 87/week @ 2024-01-31 110/week @ 2024-02-07

411 downloads per month
Used in serv4rs

LGPL-3.0

55KB
1K SLoC

Actix Easy Multipart

Build status crates.io docs.rs

Typed multipart form extractor for actix-web.

Example

use actix_web::Responder;
use actix_easy_multipart::{File, FromMultipart};
use actix_easy_multipart::extractor::MultipartForm;

#[derive(MultipartForm)]
struct Upload {
    description: Option<Text<String>>,
    timestamp: Text<i64>,
    #[multipart(rename="image_set[]")
    image_set: Vec<Tempfile>,
}

async fn route(form: MultipartForm<Upload>) -> impl Responder {
    format!("Received 5 images: {}", form.image_set.len())
}

Features

  • Receiving optional fields, using Option.
  • Receiving lists of fields, using Vec<T>.
  • Deserialize integers, floats, enums from plain text fields using Text<T>.
  • Deserialize complex data from JSON uploads, using Json<T>.
  • Receive file uploads into temporary files on disk, using Tempfile.
  • User customisable asynchronous field readers, for example you may want to stream form data to an object storage service, just implement the FieldReader trait.

Versions and Compatibility

actix-easy-multipart actix-web tokio
0.x 2.x 0.2
1.x 3.x 0.2
2.x 4.x 1
3.x 4.x 1

See Also

Dependencies

~19–33MB
~612K SLoC