package SZXX

  1. Overview
  2. Docs
type methd =
  1. | Stored
  2. | Deflated
val sexp_of_methd : methd -> Sexplib0.Sexp.t
type version =
  1. | Zip_2_0
  2. | Zip_4_5
val sexp_of_version : version -> Sexplib0.Sexp.t
type descriptor = {
  1. crc : Core_kernel.Int32.t;
  2. compressed_size : Core_kernel.Int64.t;
  3. uncompressed_size : Core_kernel.Int64.t;
}
val sexp_of_descriptor : descriptor -> Sexplib0.Sexp.t
type extra_field = {
  1. id : int;
  2. size : int;
  3. data : string;
}
val sexp_of_extra_field : extra_field -> Sexplib0.Sexp.t
type entry = {
  1. version_needed : version;
  2. flags : int;
  3. trailing_descriptor_present : bool;
  4. methd : methd;
  5. descriptor : descriptor;
  6. filename : string;
  7. extra_fields : extra_field list;
}
val sexp_of_entry : entry -> Sexplib0.Sexp.t
module Action : sig ... end
module Data : sig ... end
type 'a slice = {
  1. buf : 'a;
  2. pos : int;
  3. len : int;
}
type feed =
  1. | String of unit -> string option Lwt.t
  2. | Bigstring of unit -> Core_kernel.Bigstring.t slice option Lwt.t
val stream_files : feed:feed -> (entry -> 'a Action.t) -> (entry * 'a Data.t) Lwt_stream.t * unit Lwt.t

Stream files.

SZXX.Zip.stream_files ~feed callback

feed: Produces data for the parser. This data can be simple strings or bigstrings. Return None to indicate EOF.

callback: function called on every file found within the ZIP archive. You must choose an Action for SZXX to perform over each file encountered within the ZIP archive.

Return Action.Skip to skip over the compressed bytes of this file without attempting to uncompress them. Return Action.String to collect the whole uncompressed file into a single string. Return Action.Fold_string to fold this file into a final state, in string chunks of ~1k-5k. Return Action.Fold_bigstring to fold this file into a final state, in bigstring chunks of ~1k-5k. Return Action.Parse to apply an Angstrom.t parser to the file while it is being uncompressed without having to fully uncompress it first.

This function returns stream * success_promise stream contains all files in the same order they were found in the archive. success_promise is a promise that resolves once the entire zip archive has been processed.

Important: bind to/await success_promise in order to capture any errors encountered while processing the file.

See README.md for examples on how to use it.

OCaml

Innovation. Community. Security.