Skip to content
Advertisement

Tag: data-uri

Data URI to JSON in Javascript?

I am facing a problem where my server app gets a JSON’s DataURI and I would like to parse it into a JSON again. How could I do this? I tried different things but nothings seems to work. I tried simply parsing it or encodeURI(data); but still I can’t get the original JSON. This is the Data URI: data:application/json;base64,ew0KICAgICJtYWx0X3R5cGUiOiAibG9nIiwNCiAgICAibWFsdF9kYXRhIjogIldvdywgdSByIGFsbW9zdCB0aGVyZSA6TyINCn0= I

Image file size from data URI in JavaScript

I am not sure it’s even possible but – can I get the image file size from data URI? For example, let’s say there is an IMG element where src goes: Based on the src, can I get the image file size by using plain JavaScript? (without server request) Answer If you want file size, simply decode your base64 string

Download data URL file

I’m playing with the idea of making a completely JavaScript-based zip/unzip utility that anyone can access from a browser. They can just drag their zip directly into the browser and it’ll let them download all the files within. They can also create new zip files by dragging individual files in. I know it’d be better to do it serverside, but

Advertisement