end else (* other URL, pass it to wget *)
use_wget ()
-let bufsiz = 16384
+let bufsiz = 16384 (* for g{,un}zip *)
+let trailing_dot_gz_RE = Pcre.regexp "\\.gz$" (* for g{,un}zip *)
+
let gzip ?(keep = false) fname =
+ debug_print (sprintf "gzipping %s (keep: %b)" fname keep);
let (ic, oc) = (open_in fname, Gzip.open_out (fname ^ ".gz")) in
let buf = String.create bufsiz in
(try
Gzip.close_out oc;
if not keep then Sys.remove fname
-let trailing_dot_gz_RE = Pcre.regexp "\\.gz$"
let gunzip ?(keep = false) fname =
+ debug_print (sprintf "gunzipping %s (keep: %b)" fname keep);
let basename = Pcre.replace ~rex:trailing_dot_gz_RE fname in
assert (basename <> fname);
let (ic, oc) = (Gzip.open_in fname, open_out basename) in