Read from a compressed "GZIP" file

zabrane Mikael zabrane3@REDACTED
Fri Nov 27 15:11:56 CET 2009


Hi List,

Is there a way to read from a GZIPped file (example please)?
I found a mode called "compressed" in the "file" module, but failed to
understand how it works:

$ erl
1> {ok, FH} = file:open("foo.gz", [read, compressed]).
{ok,<0.42.0>}

2> {ok, Bin} = file:read(FH, 8).
** exception error: no match of right hand side value {error,terminated}

Why am I faling to read 8 bytes from it?
How can I read the whole file in one go?

Regards
Zabrane


More information about the erlang-questions mailing list