camlzip icon indicating copy to clipboard operation
camlzip copied to clipboard

Functorize Zip reading/writing functionality to permit different backends

Open zindel opened this issue 3 years ago • 3 comments

Motivation

Our web endpoint needs to construct fairly small zip files consisting of multiple CSVs (think export of multiple independent queries). With the current implementation, we need to use the temporary files, clean them up, involve disk I/O etc. Functorization of the Zip module permitted us to have memory backend for this operation, leaving all the heavy lifting in the Zip's responsibility, just collecting the Buffer.contents in the end.

Description

  • all changes are additive and backward-compatible
  • new names introduced in Zip.mli: READER, IN_CHANNEL, Make_reader, WRITER, OUT_CHANNEL, Make_writer
  • minizip test is updated (-b flag) to test/demonstrate new capabilities (functionally, it is the same as before)
  • for easier review, the changes are done in 3 commits: functorization itself, adding tests & fixing indentation(purely housekeeping, just indenting functors contents 2 symbols)
  • the code developed & tested with 4.07.0 as stated in camlzip.opam
  • works on production compiled with 4.11.2
  • the code may become redundant when Modular IO lands in the compiler, but quite useful until then

zindel avatar Jul 21 '21 10:07 zindel

this seems to be a popular request for camlzip, please consider this PR

ygrek avatar Sep 27 '21 16:09 ygrek

any feedback please? :pray:

ygrek avatar Dec 02 '21 17:12 ygrek

Apologies, but all my OCaml time is being consumed by the Multicore merge. Maybe it's time for me to find additional maintainers for Camlzip.

xavierleroy avatar Dec 03 '21 16:12 xavierleroy