zip, LZ77, etc.

Bjorn Gustavsson <>
Wed Oct 23 12:38:39 CEST 2002


In addition, the file:open(Name, Options) allows you to passed the atom `compressed'
in the Options list to have files be compressed/uncompressed when written/read.
(Seems to be still undocumented in R9.)

If you are interested in compressing Erlang terms, it can be done like this:

term_to_binary(Term, [compressed]).

(Documented!)

binary_to_term/1 will automatically uncompress such a binary.

/Bjorn

Luke Gorrie <> writes:

> "Jozsef Berces (QCZ)" <> writes:
> 
> > Hi,
> > 
> > Is it possible to (un)compress something (binary, list) via an erlang
> > function? Since gzipped files can be read and written zlib must be
> > there, but how to access it from erlang?
> 
> I don't know the exact usage off hand, but the 'ram_file' module does
> it.
> 
> -Luke
> 

-- 
Björn Gustavsson            Ericsson Utvecklings AB
      ÄT2/UAB/F/P
			    BOX 1505
+46 8 727 56 87 	    125 25 Älvsjö



More information about the erlang-questions mailing list