File size from base64 calculation
davejm opened this issue · comments
Out of interest, how did you come up with this calculation? @alextanhongpin
compress.js/src/core/base64.js
Line 3 in 881f199
Well, initially I thought that the size in base64 is supposed to be 4/3 times the original length, but then I came across this: https://en.wikipedia.org/wiki/Base64
Very roughly, the final size of Base64-encoded binary data is equal to 1.37 times the original data size + 814 bytes (for headers). The size of the decoded data can be approximated with this formula:
bytes = (string_length(encoded_string) - 814) / 1.37
Interesting. Thanks!