'compressed' flag in file:open/2

Matthias Lang matthias@REDACTED
Mon Aug 5 13:57:02 CEST 2002


Hi,

A month or two ago, there was some discussion about using the
'compressed' flag in file:open to access gzip-compressed files.

  http://www.erlang.org/ml-archive/erlang-questions/200206/msg00115.html

I just had a bit of a play with this, and I can see a possible reason
for why it isn't documented. In R8B-1 on linux:

  1>  {ok, F} = file:open("blaha.gz", [compressed]).
  {ok,<0.39.0>}
  2> file:position(F, 1000).

this hangs the emulator (100% CPU, ^G doesn't work, ^C twice kills the
emulator). 'blaha.gz' is much shorter than 1000 bytes, compressed or
not. I haven't investigated why beyond checking that zlib.h supports
seeking forwards and backwards (it does).

The 'ram' flag discussed in the same thread also isn't documented.

BTW, lovely ASCII art diagrams in file.erl, whoever drew them!

Matthias



More information about the erlang-questions mailing list