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

#2266 in Parser implementations

Download history 195758/week @ 2025-10-21 206299/week @ 2025-10-28 214571/week @ 2025-11-04 189461/week @ 2025-11-11 238737/week @ 2025-11-18 203670/week @ 2025-11-25 243184/week @ 2025-12-02 264595/week @ 2025-12-09 256001/week @ 2025-12-16 173157/week @ 2025-12-23 184842/week @ 2025-12-30 302727/week @ 2026-01-06 350590/week @ 2026-01-13 417997/week @ 2026-01-20 459184/week @ 2026-01-27 583920/week @ 2026-02-03

1,871,846 downloads per month
Used in 990 crates (54 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