top | item 40497227

(no title)

erhaetherth | 1 year ago

base64 is the opposite of compressed. Does it actually apply compression before base64-encoding? Doesn't really look like it by watching the URL.

discuss

order

bozey07|1 year ago

What gave you that impression? I tried spamming "a" and the URL indeed did not get longer.

Reassuringly:

   function serialize(value) {
        if (value === '') { return ''; }
        const data = new TextEncoder().encode(value);
        const compressed = pako.deflate(data, { level: 9 });
        return Base64.fromUint8Array(compressed, true);
    }

valbaca|1 year ago

it does get longer. rather than typing in aaaa copy and paste it and copy and paste that to grow exponentially

skipnup|1 year ago

It’s actually compressed. It uses https://github.com/nodeca/pako and then applies base64. Try entering hundreds of "a" and you’ll see that the base64 doesn’t really get much longer.