Skip to content

Tag: gzip

Difference between gzip and x-gzip content? If so, how to I decompress x-gzip? zlib is choking

I have a library, published via npm as “by-request”, which can, among other things, auto-decompress web content. Part of the code to handle this situation looks like this: The code had been working pretty well until I tried to read a file of astronomical info from here: I was hitting the reject(UNSUPPORTED_MEDIA_TYPE) error handler because I hadn’t specifically handled

I want to decompress a GZIP string with JavaScript

I have this GZIPed string: H4sIAAAAAAAA//NIzcnJVyguSUzOzi9LLUrLyS/XUSjJSMzLLlZIyy9SSMwpT6wsVshIzSnIzEtXBACs78K6LwAAAA== I created that with this website: I have tried using pako to ungzip it. The issue is that Pako throws the error: incorrect header check What am I missing here? A JSbin Answer The “H4sIAAAAAAAA//NIzcnJVyguSUzOzi9LLUrLyS/XUSjJSMzLLlZIyy9SSMwpT6wsVshIzSnIzEtXBACs78K6LwAAAA==” is a base64 encoded string, you first need to decode that into a buffer. textEncoder.encode just encodes that