1个不稳定版本

0.1.0 2021年6月27日

#693HTTP服务器

Download history 562/week @ 2024-03-28 506/week @ 2024-04-04 688/week @ 2024-04-11 487/week @ 2024-04-18 335/week @ 2024-04-25 366/week @ 2024-05-02 298/week @ 2024-05-09 336/week @ 2024-05-16 341/week @ 2024-05-23 474/week @ 2024-05-30 286/week @ 2024-06-06 384/week @ 2024-06-13 431/week @ 2024-06-20 448/week @ 2024-06-27 307/week @ 2024-07-04 224/week @ 2024-07-11

1,471 每月下载量
用于 warp-fix-171

MIT/Apache

42KB
884

multiparty

crates.io Documentation dependency status Rustc Version 1.45.2+ CI codecov

简单的零拷贝*流式多部分解码器实现。

还公开了底层的Sans IO解码器,可用于futures 0.3生态系统之外。

示例

multiparty = { version = "0.1", features = ["server", "futures03"] }
use multiparty::server::owned_futures03::FormData;
use futures_util::stream::TryStreamExt;

let boundary = todo!("A multipart/form-data boundary");
let stream = todo!("A Stream<Item = std::io::Result<Bytes>> + Unpin");
let mut multipart = FormData::new(stream, boundary);

while let Some(mut part) = multipart.try_next().await? {
    let headers = part.raw_headers().parse()?;
    println!("name: {:?}", headers.name);
    println!("filename: {:?}", headers.filename);
    println!("content_type: {:?}", headers.content_type);

    while let Some(bytes) = part.try_next().await? {
        println!("Read {} bytes from the current part", bytes.len());
    }

    println!("Reached the end of this part");
}

许可证

许可方式如下

任选其一。

贡献

除非你明确声明,否则你故意提交以包含在作品中的任何贡献,均应按上述方式双重许可,不附加任何额外条款或条件。


* 除非是小于边界长度一半的Bytes流。

依赖项

~130–295KB