package SZXX

  1. Overview
  2. Docs
type methd =
  1. | Stored
  2. | Deflated
val sexp_of_methd : methd -> Sexplib0.Sexp.t
val compare_methd : methd -> methd -> Base.int
val equal_methd : methd -> methd -> Base.bool
type version =
  1. | Zip_2_0
  2. | Zip_4_5
val sexp_of_version : version -> Sexplib0.Sexp.t
val compare_version : version -> version -> Base.int
val equal_version : version -> version -> Base.bool
type descriptor = {
  1. crc : Base.Int32.t;
  2. compressed_size : Base.Int64.t;
  3. uncompressed_size : Base.Int64.t;
  4. offset : Base.Int64.t Base.option;
}
val sexp_of_descriptor : descriptor -> Sexplib0.Sexp.t
val compare_descriptor : descriptor -> descriptor -> Base.int
val equal_descriptor : descriptor -> descriptor -> Base.bool
type extra_field = {
  1. id : Base.int;
  2. size : Base.int;
  3. data : Base.string;
}
val sexp_of_extra_field : extra_field -> Sexplib0.Sexp.t
val compare_extra_field : extra_field -> extra_field -> Base.int
val equal_extra_field : extra_field -> extra_field -> Base.bool
type entry = {
  1. version_needed : version;
  2. flags : Base.int;
  3. trailing_descriptor_present : Base.bool;
  4. methd : methd;
  5. descriptor : descriptor;
  6. filename : Base.string;
  7. extra_fields : extra_field Base.list;
  8. comment : Base.string;
}
val sexp_of_entry : entry -> Sexplib0.Sexp.t
val compare_entry : entry -> entry -> Base.int
val equal_entry : entry -> entry -> Base.bool
module Action : sig ... end
module Data : sig ... end
val stream_files : sw:Eio.Std.Switch.t -> feed:Feed.t -> (entry -> 'a Action.t) -> (entry * 'a Data.t) Base.Sequence.t

Stream files from a ZIP archive. This function operates in a single pass.

SZXX.Zip.stream_files ~sw ~feed callback

sw: A regular Eio.Switch.t.

feed: A producer of raw input data. Create a feed by using the SZXX.Feed module.

callback: A function called on every file found within the ZIP archive. You must choose an Action (SZXX.Zip.Action.t) 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 decompress them. The file's integrity is still validated as usual. Return Action.Fast_skip to skip over the compressed bytes without attempting to decompress or validate them Return Action.String to collect the whole decompressed file into a single string. Return Action.Bigstring to collect the whole decompressed file into a single bigstring. More efficient than Action.String if you don't need to convert the result into a string. Return Action.Fold_string to fold this file into a final state, in string chunks of ~8192 bytes. Return Action.Fold_bigstring to fold this file into a final state, in bigstring chunks of ~8192 bytes. IMPORTANT: this Bigstringaf.t is volatile! It's only safe to read from it until the end of function f (the "folder"). If you need to access the data again later, copy it in some way before the end of function f. Return Action.Parse to apply an Angstrom.t parser to the file while it is being decompressed without having to fully decompress it first. Parse expects the parser to consume all bytes and leave no trailing junk bytes after a successful parse. Return Action.Parse_many to repeatedly apply an Angstrom.t parser to the file while it is being decompressed without having to fully decompress it first. Call on_parse on each parsed value. Parse_many expects the file to end with a complete parse and leave no trailing junk bytes. Return Action.Terminate to abruptly terminate processing of the ZIP archive. The output Sequence will finish with a Data.Terminate element. SZXX stops reading from the Feed.t immediately, without even skipping over the bytes of that entry.

This function returns a Sequence of all files in the archive. The order of the files passed to the callback and on the Sequence matches the arrangement of the files within the ZIP.

SZXX will wait for you to consume from the Sequence before extracting more.

val index_entries : _ Eio.File.ro -> entry Base.list

Return a list of all entries in a ZIP file. This function is more efficient than the SZXX.Zip.stream_files equivalent, but it can only operate on files.

val extract_from_index : _ Eio.File.ro -> entry -> 'a Action.t -> 'a Data.t

Given an entry extracted from SZXX.Zip.index_entries, this function extracts a single specific file. This function is more efficient than the SZXX.Zip.stream_files equivalent, but it can only operate on files.

OCaml

Innovation. Community. Security.