I'm trying to find a way to reduce size of BASE64 encoded images that I'm sending to the server. I found that question where LZMA is suggested solution. However when I check request size on the server I see that size of the uncompressed version is ~10 times smaller. Do I missing a step? I see that result of compression is a Byte Array
I tried to use .toString('utf8')
method but it seems it just join the array.
/* LZMA COMPRESS / DECOMPRESS */
.factory('ooLZMA', ['CONFIG', function (CONFIG) {
return {
compress: function (string) {
return LZMA.compress(string, CONFIG.stringCompression);
},
decompress: function () {
return LZMA.decompress(string);
}
}
}])
And on the server:
console.log('size', req.headers['content-length'] / 1048576, 'comp', req.body.compressed);
//"compressed"
size 0.1276998519897461 comp true
//raw BASE64
size 0.01657390594482422 comp false