-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding blob.dataUrl()
method, or some other analogue to readAsDataURL
#179
Comments
I'd be very hesitant adding methods like that that don't also exists in the |
Agreed, it would be great to add it to Going by those usage numbers |
What kind of use cases does this enable and are we sure those are best-served with |
Yeah, it'd be great to see a breakdown of a small (but statistically significant) subset of those 1.6 million hits to see what percentage of them are using data URLs because they're roughly the best available option vs because the dev didn't know about better options like |
Yeah. And note that I don't think we should enshrine |
I'm out of the loop on this -- quick summary of this approach? |
See |
Also related: When ppl want to display a image preview from a file input, then i recommend ppl to just use I do know the risk of not revoking things. |
TPAC 2024: Feature request. Will revisit if .dataUrl() is added to |
Obviously data URLs and base64 in general should be avoided where possible, but unfortunately developers are often interacting with systems/libraries/APIs outside their control, and, practically,
readAsDataURL
is used a lot.In fact,
readAsDataURL
is used about as much asreadAsText
andreadAsArrayBuffer
combined:The
blob.arrayBuffer()
andblob.text()
methods are delightful to use compared to previous methods, but for data URLs / base64 we're stuck with:which is the opposite of delightful. This is one of those cases where I'm "embarrassed" by how convoluted a simple task is in JS when helping someone who is new to JS.
There are a couple of proposals that are related to this issue:
That said, I really like promise-based
blob.methodName()
approach, and I'm hoping that we'll eventually get something like that for data URLs.The text was updated successfully, but these errors were encountered: