Reputation: 4853
I have an Erlang app which makes a large number of http client calls using inets. I'd like to reduce my bandwidth bill by accepting gzipped data from servers that provide it. Is there an inets option that would handle this ? [can't find one]. Is there a zip library anyone could recommend ? [I've looked at the stdlib zip library, but it seems only to unzip archives, rather than uncompress individual streams].
Thanks!
Upvotes: 4
Views: 1526
Reputation: 567
I'd suggest to do compression/decompression at HTTP frontend (nginx, apache, etc). This will be more optimal.
Upvotes: 0
Reputation: 26141
Look at zlib
module. Look also at file:open/2
option compressed
for possible future usage. Note that zip
and zlib
aka gzip
is not same thing. I think you already note it.
Look at http://blog.gebhardtcomputing.com/2007/09/grab-webpage-in-erlang-which-is-gzipped.html for some inspiration, but you probably will need streaming which is well described in manual page.
Upvotes: 3