tags:

views:

72

answers:

2

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!

+2  A: 

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.

Hynek -Pichi- Vychodil
zlib:gunzip works great for gzipped data; any ideas on how to parse [http] content encoded with 'deflate' ?
Justin
A: 

I'd suggest to do compression/decompression at HTTP frontend (nginx, apache, etc). This will be more optimal.

Alexey Timanovsky