1

I've uploaded a zip file to S3. The zip file contains a compressed json file.

How do I open this zip file and get the json content?

$.ajax({
                url: "url/list.zip",
                data: {},
                type: "GET",
                success: function(data) {
                    var result = JSON.parse(data);
                    $.each(result, function(i, res) {
                        map[res.s] = res;
                        results.push(res.s);
                    });
                }
            });             
iCodeLikeImDrunk
  • 14,925
  • 33
  • 95
  • 157

2 Answers2

1

I did it with PHP and this header:

header('Content-Encoding: gzip');

It works fine. Thanks

0

One solution I found was to set the proper metadata for the file. Browsers will automatically do its thing to decompress and get you the content.

ie:

My gzip file had a json file inside. I set the content-type to "text/plain" and encoding to "gzip". I was able to get the data with no problems.

FYI I am doing all this uploading/downloading via Amazon S3.

iCodeLikeImDrunk
  • 14,925
  • 33
  • 95
  • 157