Anybody have a complete example of compressing and decompressing a stream of data with zlib?

Does anybody have a complete example of compressing and decompressing a stream of data with zlib ? The example on Erlang -- zlib only shows compression and references a Read() function which doesn’t appear to be defined.

1 Like

What I’m trying to accomplish is sending compressed chunks of a file from one process to another and decompressing them chunk by chunk on the other end (to write to a file).

1 Like

Take a look at cowboy repo, this module uses zlib, hope it can help you.

1 Like

In the example, they assume a read function that can return iodata() multiple times or end_of_data when there is no more data. This function should be bound as a fun to the variable Read.

2 Likes