camlzip
camlzip copied to clipboard
Functorize Zip reading/writing functionality to permit different backends
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 incamlzip.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
any feedback please? :pray:
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.