Module Biocaml_zip (.ml)

Streaming interface to the Zlib library.

module Biocaml_zip: 
sig

The module deals with compressed streams.

Default Parameters


module Default: 
sig

This module contains the default values for most optional parameters of the module.
val zlib_buffer_size : int
The default size of the internal buffer used by the ZLib library. It's value is 4096.
val level : int
The default compression level used in Transform.zip. It's value is 3, bigger values (up to 9) decrease performance while slightly improving the compression.
end

Error Types


module Error: 
sig
type unzip = [ `garbage_at_end_of_compressed_data of string
| `wrong_gzip_header of
[ `compression_method | `flags | `magic_number ] * int
| `zlib of string ]
The possible unzipping errors.
type t = unzip 
The union of the errors.
val unzip_of_sexp : Sexplib.Sexp.t -> unzip
val sexp_of_unzip : unzip -> Sexplib.Sexp.t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
end

In_chanel.t Functions


val unzip_in_channel : ?format:[ `gzip | `raw ] ->
?zlib_buffer_size:int ->
?buffer_size:int ->
Pervasives.in_channel ->
(string, [> Error.t ]) Core.Result.t Stream.t
Decompress an Input Channel.
val zip_in_channel : ?format:[ `gzip | `raw ] ->
?zlib_buffer_size:int ->
?level:int -> ?buffer_size:int -> Pervasives.in_channel -> string Stream.t
Compress an Input Channel.
exception Error of Error.unzip
The exception raise by the *_exn functions of this module.
val unzip_in_channel_exn : ?format:[ `gzip | `raw ] ->
?zlib_buffer_size:int ->
?buffer_size:int -> Pervasives.in_channel -> string Stream.t
Like unzip_in_channel but calls to Stream.next may raise Error e exceptions.

Transform.t Implementations


module Transform: 
sig
val unzip : ?format:[ `gzip | `raw ] ->
?zlib_buffer_size:int ->
unit ->
(string, (string, [> Biocaml_zip.Error.unzip ]) Core.Result.t)
Biocaml_transform.t
Create a transform that uncompresses a stream. The default format is `raw (i.e. only apply the "deflate" algorithm to the stream); `gzip means that the transform must first skip a gzip header.
val zip : ?format:[ `gzip | `raw ] ->
?level:int ->
?zlib_buffer_size:int -> unit -> (string, string) Biocaml_transform.t
Create a transform that writes compressed data.
end
end