package SZXX

  1. Overview
  2. Docs

Module SZXX.ZipSource

Sourcetype methd =
  1. | Stored
  2. | Deflated
Sourceval sexp_of_methd : methd -> Sexplib0.Sexp.t
Sourceval compare_methd : methd -> methd -> int
Sourceval equal_methd : methd -> methd -> bool
Sourcetype version =
  1. | Zip_2_0
  2. | Zip_4_5
Sourceval sexp_of_version : version -> Sexplib0.Sexp.t
Sourceval compare_version : version -> version -> int
Sourceval equal_version : version -> version -> bool
Sourcetype descriptor = {
  1. crc : Core.Int32.t;
  2. compressed_size : Core.Int64.t;
  3. uncompressed_size : Core.Int64.t;
  4. offset : Core.Int64.t option;
}
Sourceval sexp_of_descriptor : descriptor -> Sexplib0.Sexp.t
Sourceval compare_descriptor : descriptor -> descriptor -> int
Sourceval equal_descriptor : descriptor -> descriptor -> bool
Sourcetype extra_field = {
  1. id : int;
  2. size : int;
  3. data : string;
}
Sourceval sexp_of_extra_field : extra_field -> Sexplib0.Sexp.t
Sourceval compare_extra_field : extra_field -> extra_field -> int
Sourceval equal_extra_field : extra_field -> extra_field -> bool
Sourcetype 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;
  8. comment : string;
}
Sourceval sexp_of_entry : entry -> Sexplib0.Sexp.t
Sourceval compare_entry : entry -> entry -> int
Sourceval equal_entry : entry -> entry -> bool
Sourcemodule Action : sig ... end
Sourcemodule Data : sig ... end
Sourceval stream_files : sw:Eio.Std.Switch.t -> feed:Feed.t -> (entry -> 'a Action.t) -> (entry * 'a Data.t) Core.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 Bigstring.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.

Sourceval index_entries : Eio.File.ro -> entry 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.

Sourceval 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.