Can I turn Base85 into a data URL? If so how?

0

I just recently learned of a much much more efficient version of base, called Ascii85 (or Base85) and as seen, it is much more storage efficient than say, Base64 or Uuencode:

This is in Base85:

  • Hello = BOu!rDZ

This is in Base64:

  • Hello = SGVsbG8=

So, I was wondering if it’s possible to turn files into Base85, and if it’s possible to make data URLs out of said Base85 file codes. If so this would revolutionize my coding platform, and cause those enormous Base64 file sources to shrink by a large sum.

If above is possible, is there an automated data URL maker for it?

TaylorS

Posted 2019-05-03T00:09:25.570

Reputation: 121

What is the actual problem you are trying to solve here? Encoding, decoding and re-encoding are all kind of trivial tasks once you have a goal. So what is your ultimate goal and why? – JakeGould – 2019-05-03T02:13:40.687

Answers

1

So, I was wondering if it’s possible to turn files into Base85

Yes. But if you're going to store them as files, the most efficient way of encoding them is to not encode them at all.

and if it’s possible to make data URLs out of said Base85 file codes

No. Base64 is the only encoding supported for data: URLs -- it is defined as a special case in RFC 2397.

duskwuff -inactive-

Posted 2019-05-03T00:09:25.570

Reputation: 3 824

“But if you're going to store them as files, the most efficient way of encoding them is to not encode them at all.” Exactly. Also, this question is really an XY problem because ultimately converting data from one encoding to another is pretty trivial.

– JakeGould – 2019-05-03T02:16:38.670

I only asked because I store lots of files in my offline 1 html file Programs that I make, and storing files as data urls is very data consuming but very useful, as I said, I only asked because its much more efficient, and the data urls would be shortened immensely – TaylorS – 2019-05-03T12:22:13.590

0

Of course yes. We know the way to encode and decode each of those encodings, so base64 data can be converted back to normal data, which will be in turn converted to base85

SGVsbG8= → Hello → BOu!rDZ

Also note that there are other more efficient encodings than base85, with faster encode/decode speed. For example base91 can be encoded/decoded with a lookup table, and base122 is a pure binary encoding. OTOH base85 always need multiplication/division for encoding/decoding

However depending on where you want to use different encodings may have different efficiency. For example inside html files there are some forbidden characters, so base95 needs some escaping which may be worse than base64 itself. Similarly in a URL only some characters are allowed, others will be encoded with % which is even longer than the original data

See What is the most efficient binary to text encoding?

phuclv

Posted 2019-05-03T00:09:25.570

Reputation: 14 930

How does this answer the core question: “If above is possible, is there an automated data URL maker for it?” – JakeGould – 2019-05-03T02:12:55.193