From 4f28912cfb4b13d31944d022580b7324655cc479 Mon Sep 17 00:00:00 2001 From: Cheng Xu Date: Fri, 12 Dec 2025 13:47:24 -0800 Subject: [PATCH] feat(data-url): add base64 flag accessor Add public API to check if the data URL uses base64 encoding. This is useful if someone wants to create a new data URL based on an existing one and keep the same encoding scheme. --- data-url/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data-url/src/lib.rs b/data-url/src/lib.rs index 44966a13..616412a9 100644 --- a/data-url/src/lib.rs +++ b/data-url/src/lib.rs @@ -90,6 +90,11 @@ impl<'a> DataUrl<'a> { &self.mime_type } + /// Return whether the data URL uses base64 encoding. + pub fn is_base64(&self) -> bool { + self.base64 + } + /// Streaming-decode the data URL’s body to `write_body_bytes`, /// and return the URL’s fragment identifier if it has one. pub fn decode(