Giter Club home page Giter Club logo

mime-multipart's Introduction

mime-multipart

MIT licensed Apache-2.0 licensed

Rust library for MIME multipart parsing, construction, and streaming

This crate predates rust async support. It will remain pre-async to support codebases which aren't intending to be rewritten under the async methodology. That means we will remain on hyper 0.10.

Documentation is available at https://docs.rs/mime-multipart

Features

  • Parses from a stream, rather than in memory, so that memory is not hogged.
  • Streams parts which are identified as files (via the part's Content-Disposition header, if any, or via a manual override) to files on disk.
  • Uses buffered streams.
  • Lets you build and stream out a multipart as a vector of parts (Nodes), some of which could be files, others could be nested multipart parts.

If you are specifically dealing with multipart/formdata, you may be interested in https://github.com/mikedilger/formdata which uses this crate and takes it a step further.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

mime-multipart's People

Contributors

fliegendewurst avatar golddranks avatar lukaspustina avatar mikedilger avatar richardwhiuk avatar stentroad avatar zyddnys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mime-multipart's Issues

Stack overflow when attempting to display error types.

It appears that your Display implementation calls itself recursively forever.

reproduce with:

     #[test]
     fn display_error() {
         let custom_error = std::io::Error::new(std::io::ErrorKind::Other, "oh no!");
         println!("{}", Error::Io(custom_error));
     }
    

Generate multipart/* from a Vec<Node>

Currently we don't generate anything, we only parse (parsing was the harder job). As soon as someone needs us to generate, we can do that.

At that time FilePart will need to make tempdir public, and size Optional, as users will pass these to us.

Switch to async API

This crate is built upon an older, pre-async version of hyper, and as a result the API is also blocking. The hyper ecosystem has moved to async.

I've analyzed a little bit what I think should be done:

Will you accept a PR?

Parse the outer headers too, supporting non-hyper users

Right now, for downstream crates which have data from hyper, we take Headers and the stream as separate arguments to parse_multipart().

However, in the future, data may come from sources other than Hyper (e.g. an email system, a file, etc). In those cases we should take just the stream, and parse off the headers ourselves. This will be easy to implement since we already parse internal headers ourselves (using httparse).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.