caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rich@annexia.org>
To: Francois Berenger <berenger@riken.jp>
Cc: caml-list <caml-list@inria.fr>,
	batteries-devel@lists.forge.ocamlcore.org,
	OCaml Beginners List <ocaml_beginners@yahoogroups.com>
Subject: Re: [Caml-list] Any library for reading/writing compressed files?
Date: Fri, 18 May 2012 23:14:04 +0100	[thread overview]
Message-ID: <20120518221404.GA26540@annexia.org> (raw)
In-Reply-To: <4FB1BB82.6010900@riken.jp>

On Tue, May 15, 2012 at 11:12:18AM +0900, Francois Berenger wrote:
> Hello,
> 
> What's the gold standard in OCaml to read/write
> compressed files?
> 
> I found this: http://forge.ocamlcore.org/projects/camlzip/
> 
> Wouldn't it be possible that the Marshall module
> had an option to allow compression of the marshalled
> values?
> Or is there a simple way to achieve this?

If it's for Unix, then just open a pipe to or from an external
compression filter, eg:

  open Unix
  open Printf

  let () =
    let output = "output.xz" in
    let chan =
      open_process_out (sprintf "xz --best > %s"
                            (Filename.quote output)) in
    output_value chan 42;
    let status = close_process_out chan in
    (* some code here to check status was ok *)
    ()

(Also a good way to generate images from OCaml programs: pipe
to pnmto* programs).

Rich.

-- 
Richard Jones
Red Hat

  reply	other threads:[~2012-05-18 22:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15  1:48 [Caml-list] Any tool for unit tests as comments in OCaml source? Francois Berenger
2012-05-15  2:08 ` Thibault Suzanne
2012-05-15  2:08 ` Edgar Friendly
     [not found] ` <4FB1B60F.3060408@riken.jp>
2012-05-15  2:12   ` [Caml-list] Any library for reading/writing compressed files? Francois Berenger
2012-05-18 22:14     ` Richard W.M. Jones [this message]
2012-05-19  1:25       ` Adrien
2012-05-19  1:27         ` Adrien
2012-05-21  1:20           ` Francois Berenger
2012-05-21  6:11             ` Adrien
2012-05-15  5:29 ` [Caml-list] Any tool for unit tests as comments in OCaml source? Cedric Cellier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120518221404.GA26540@annexia.org \
    --to=rich@annexia.org \
    --cc=batteries-devel@lists.forge.ocamlcore.org \
    --cc=berenger@riken.jp \
    --cc=caml-list@inria.fr \
    --cc=ocaml_beginners@yahoogroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).