1

I have an ajax response receiving as Content-Encoding as gzip.

I would like to convert it into base64 encoded string.

enter image description here

In firefox/firebug Net tab I can open response and see in base64 encoded text.

enter image description here

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)

enter image description here

Teoman shipahi
  • 47,454
  • 15
  • 134
  • 158

1 Answers1

1

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.

Community
  • 1
  • 1
mti2935
  • 11,465
  • 3
  • 29
  • 33