6 releases

0.3.2 Aug 21, 2025
0.3.1 Nov 22, 2023
0.3.0 Jun 5, 2023
0.2.0 Sep 8, 2022
0.1.0 Feb 2, 2018

#2167 in Parser implementations

Download history 269776/week @ 2025-12-13 172794/week @ 2025-12-20 177505/week @ 2025-12-27 277602/week @ 2026-01-03 349384/week @ 2026-01-10 392423/week @ 2026-01-17 445959/week @ 2026-01-24 521252/week @ 2026-01-31 588825/week @ 2026-02-07 518732/week @ 2026-02-14 471208/week @ 2026-02-21 547250/week @ 2026-02-28 643632/week @ 2026-03-07 604619/week @ 2026-03-14 603969/week @ 2026-03-21 590180/week @ 2026-03-28

2,546,228 downloads per month
Used in 1,242 crates (61 directly)

MIT/Apache

31KB
636 lines

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());

No runtime deps