zip, LZ77, etc.

Daniel Néri daniel.neri@REDACTED
Tue Oct 22 20:53:18 CEST 2002


"Jozsef Berces (QCZ)" <Jozsef.Berces@REDACTED> writes:

> I found that module but I did not see how it implemented the
> (de)compression.

Something like this seems to work:

9> {ok,F} = file:open("foo", [read,write,binary,ram]).
{ok,{file_descriptor,ram_file,#Port<0.36>}}
10> file:write(F, string:copies("hello, world!", 100)).
ok
11> {ok,Size} = ram_file:compress(F).
{ok,44}
12> file:position(F, bof).
{ok,0}
13> {ok,Compressed} = file:read(F, Size).
{ok,<<31,139,8,0,0,0,0,0,0,3,203,72,205,201,201,215,81,40,207,47,202,73,81,204,24,229,140,...>>}
14> file:close(F).
ok
15> size(Compressed).
44



Regards,
   --Daniel




More information about the erlang-questions mailing list