Reputation: 23042
I have an ajax response receiving as Content-Encoding as gzip.
I would like to convert it into base64 encoded string.
In firefox/firebug Net tab I can open response and see in base64 encoded text.
As you can see below, firebug can convert response into base64 string. I can save this file as abc.zip and unzip successfully. How can I achieve it in JavaScript? (Converting ajax response into base64 string)
Upvotes: 1
Views: 2524
Reputation: 12027
You need to decompress the gzip-encoded string first to get the string in uncompressed form, then you can base64 encode the uncompressed string.
See JavaScript implementation of Gzip for info on how to decompress gzip-encoded strings.
Upvotes: 1