need to store in cookies, but it's like 4.2KB. which I can't do.
So thought abt compressing n putting data in cookie,
After compressing the data goes down to 2.9kb.
But after making it as base64 string, to put it in cookie, size increases to 3.9kb.
Which is like 200bytes less than initial size. And is prone to fail when tokens size increases somehow.
Can anyone throw some lead on this?
Using nodejs,
Base64 increases data size by 33%. It does this by taking the bit string of the data, splitting it into chunks of 6 (right-padding with 0s if necessary), and encoding these as 8 bits. 8 is 33% larger than 6. The advantage of Base64 is that all these 8-bit chunks represent printable characters, and none of them are control characters. This makes it safer to pass through systems not designed for binary data, and also makes it easily copyable. But as you noticed, it does NOT reduce the data size, nor does it try to.
Which compression algorithm are you using?
I would try compressing with brotli first, then serializing it into ascii85 instead of base64
Using zlib. Deflate.
Yeah that's gonna be pretty shit
Do you have any sample data you can send?
It's AWS cognito tokens basically. Accesstoken, idToken and refreshtoken
Got an example? I don't use AWS
cognito tokens should be handled by cognito sdk
https://pastebin.com/MkV5CaJ7
Обсуждают сегодня