Using Zlib

Vladimir Sekissov svg@REDACTED
Wed Jun 19 19:30:22 CEST 2002

willem> Vladimir Sekissov wrote:
willem> > I've looked around the code and it seemed they could use compressed files with
willem> > `compressed' flag.
willem> Thanks, that's interesting!
willem> However, I was hoping it could be used to uncompress an incoming TCP data 
willem> stream. I guess that's out of reach... :-(

You can use ram_file, I think:

74> {ok, FD} = file:open("TestTest", [read, write, ram]).

75> ram_file:get_size(FD).

76> ram_file:position(FD, 0).

77> ram_file:read(FD, 8).

78> ram_file:compress(FD).

79> ram_file:read(FD, 26).

80> ram_file:uncompress(FD).

81> ram_file:read(FD, 8).

83> ram_file:close(FD).

See code of ram_file.erl for interface.

Best Regards,

Vladimir Sekissov

More information about the erlang-questions mailing list