actix-easy-multipart

Crates.ioactix-easy-multipart
lib.rsactix-easy-multipart
version3.0.0
sourcesrc
created_at2022-01-14 23:53:48.083095
updated_at2022-11-05 22:53:48.875896
descriptionTyped multipart form extractor for actix-web
homepagehttps://github.com/jacob-pro/actix-easy-multipart
repositoryhttps://github.com/jacob-pro/actix-easy-multipart
max_upload_size
id514122
size53,932
Jacob Halsey (jacob-pro)

documentation

README

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

Commit count: 21

cargo fmt