data-url

crates.io docs.rs

Processing of data: URLs in Rust according to the Fetch Standard: https://fetch.spec.whatwg.org/#data-urls but starting from a string rather than a parsed URL to avoid extra copies.

```rust use data_url::{DataUrl, mime};

let url = DataUrl::process("data:,Hello%20World!").unwrap(); let (body, fragment) = url.decodetovec().unwrap();

asserteq!(url.mimetype().type, "text"); asserteq!(url.mimetype().subtype, "plain"); asserteq!(url.mimetype().getparameter("charset"), Some("US-ASCII")); asserteq!(body, b"Hello World!"); assert!(fragment.isnone()); ```