Simple zero copy* streaming multipart decoder implementation.
Also exposes the underlying Sans IO decoder, for use outside of
the futures
0.3 ecosystem.
toml
multiparty = { version = "0.1", features = ["server", "futures03"] }
```rust use multiparty::server::ownedfutures03::FormData; use futuresutil::stream::TryStreamExt;
let boundary = todo!("A multipart/form-data boundary");
let stream = todo!("A Stream
while let Some(mut part) = multipart.trynext().await? { let headers = part.rawheaders().parse()?; println!("name: {:?}", headers.name); println!("filename: {:?}", headers.filename); println!("contenttype: {:?}", headers.contenttype);
while let Some(bytes) = part.try_next().await? {
println!("Read {} bytes from the current part", bytes.len());
}
println!("Reached the end of this part");
} ```
Licensed under either of * Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) * MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.
* Except for streams yielding Bytes
smaller than half the boundary length.