Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
2
vladimyr avatar

@stevekrouse While you can definitely do it manually there is a standard and ostensibly quicker way of converting File/Blob instance to dataURL: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL

To save you from the FileReader setup boilerplate I've created convertBlobToDataURL helper. You can see it in action here: https://www.val.town/v/vladimyr/dataURL_example

stevekrouse avatar

Very cool! Thank you!! I was looking for that

Updated: August 27, 2024