async_extended has Async_extended.Std.Reader.with_xzip_file

https://ocaml.janestreet.com/ocaml-core/latest/doc/async_extended/Std/Reader.mod/#/with_xzip_file.val

Internally it just invokes xzcat, which may or may not satisfy your requirements. There's (as far as I know) no provided way to write xz files.

On 9 September 2016 at 03:45, Eric Cooper <ecc@cmu.edu> wrote:
In approx, I just use a Sys.command call to decompress to a temporary
file and then open that.  It has these benefits:
  * for gzip at least, it's faster than camlzip
  * easily detects corrupted files (reading the output stream of a
    decompressor doesn't do that until it's too late)
  * easy to change compression schemes or support multiple ones based
    on file extension, say

--
Eric Cooper             e c c @ c m u . e d u

--
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs