As an official summer of cod entry, here is a start for
the libflate library, which will eventually contain
Myrddin's [de]compression equipment.
It currently exposes a single function
const decode : (outf : bio.file#, inf : bio.file# -> std.result(void, err))
that decodes a DEFLATE stream in the inf file into the
outf file. The function guarantees that it will not read
more than necessary from inf to either, figure out that
the stream is bogus, or fully uncompress the stream.
I did my due diligence with respect to testing but I am
not fully confident about the correctness of the
implementation; feel free to add more tests, or test it
on example files.
- it was fast (don't expect gunzip's speed)
- it was better tested
- it had stricter format checks (e.g., checking for
invalid Huffman codes)
- I had implemented zlib/gzip decompression
On the other hand, the current implementation is quite
simple and appears to work.