I am currently working on a client-side JavaScript application that is responsible for downloading relatively large JSON datasets for visualization. My goal is to compress these datasets in advance using gzip to conserve space and decrease bandwidth consumption (e.g. mydata.json.gz
).
The issue arises from the fact that I do not have the ability to modify the server configuration, which results in it sending Content-Type: application/x-gzip
headers instead of the correct pair of Content-Encoding: gzip
and Content-Type: application/json
for my .json.gz
files. As a result, my application receives the raw gzipped data rather than the formatted data needed for JSON.parse()
.
Although I am familiar with various pure-JavaScript Gzip implementations (such as pako) that could potentially solve the problem, I am curious if there is a way to manipulate the browser into decoding it for me without requiring an extra 45KB library.