Valentin Gosu aae60cff2b Use no-std instead of no_std in Cargo.toml (#1064) пре 1 година
..
src dbd526178e ran `cargo clippy --fix -- -Wclippy::use_self` (#1048) пре 1 година
tests e654efb9c1 Fix non-base64 data URLs with % character not followed by hex digits (#797) пре 2 година
Cargo.toml aae60cff2b Use no-std instead of no_std in Cargo.toml (#1064) пре 1 година
LICENSE-APACHE a6e63fed24 Add metadata for the data-url crate пре 8 година
LICENSE-MIT a6e63fed24 Add metadata for the data-url crate пре 8 година
README.md 9f6e92efe1 Add some some basic functions to `Mime` (#1047) пре 1 година

README.md

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.

use data_url::{DataUrl, mime};

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

assert!(url.mime_type().is("text", "plain"));
assert_eq!(url.mime_type().get_parameter("charset"), Some("US-ASCII"));
assert_eq!(body, b"Hello World!");
assert!(fragment.is_none());