4 ms·
Prior art (rather similar, but instead of being json, it's a JPEG): https://news.ycombinator.com/item?id=12262470 https://news.ycombinator.com/item?id=12262470
by jhgg 6y ago
Prior art (rather similar, but instead of being json, it's a JPEG): https://news.ycombinator.com/item?id=12262470 https://news.ycombinator.com/item?id=12262470
tldr: the html is stuffed in the exif data!
- lifthrasiir 6y agoA similar approach is (over)used for codegolfing, namely the PNG bootstrapping method [1] [2] [3]: your code is compressed into a PNG image and the bootstrap in HTML gets appended to the PNG file to decompress and eval the code. The exact method requires some experiments, as browsers change their rules to determine which is a valid image and which is a valid HTML. [1] https://gist.github.com/gasman/2560551 https://gist.github.com/gasman/2560551 [2] https://github.com/codegolf/zpng https://github.com/codegolf/zpng [3] https://xem.github.io/terser-online/ https://xem.github.io/terser-online/ (If you pick the packing method "Zopfli (DEFLATE)", open the zopfli options and change the format to "zpng", you can write directly to the "Minified (Terser)" input to download the optimized PNG. Yes I wrote that part of code and that required way too much algorithm: https://github.com/xem/terser-online/blob/5cc33125/compress.js#L114-L309 https://github.com/xem/terser-online/blob/5cc33125/compress....)