Skip to content

Instantly share code, notes, and snippets.

@rgrinberg
Created October 14, 2016 22:34
Show Gist options
  • Save rgrinberg/bf025b31d594216c2472851981ccd03e to your computer and use it in GitHub Desktop.
Save rgrinberg/bf025b31d594216c2472851981ccd03e to your computer and use it in GitHub Desktop.
open Core.Std
let compress s =
let (r, w) = Unix.pipe () in
let w = Unix.out_channel_of_descr w in
let gz = Gzip.open_out_chan w in
Gzip.output gz s 0 (String.length s);
Gzip.close_out gz;
let r = Unix.in_channel_of_descr r in
In_channel.input_all r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment