package zipc

  1. Overview
  2. Docs

Archive members.

Members

type kind =
  1. | Dir
    (*

    Member is a directory.

    *)
  2. | File of File.t
    (*

    Member is a file.

    *)

The type for archive member kinds.

type t

The type for archive members.

val make : ?mtime:Ptime.t -> ?mode:int -> path:Fpath.t -> kind -> (t, string) result

make ~path kind creates a member for path of kind kind.

  • path goes through Fpath.ensure_unix and, if the member is a directory, Fpath.ensure_directoryness. Note that when you add the resulting member to an archive you may not be able to find it with the given path, you need to use the path of the result.
  • mtime defaults to Ptime.dos_epoch. ZIP archives use MS-DOS date time whose epoch is on Ptime.dos_epoch anything before is truncated to it
  • mode defaults 0o755 for directory entries and 0o644 for files.

Error _ is returned with a suitable error message if the length of path exceeds max_path_length.

val path : t -> Fpath.t

path m is the file path of m.

WARNING do not use this path on a file system without sanitizing it. Also, it may be the empty string.

val mode : t -> Fpath.mode

mode m is the UNIX file mode of m.

val mtime : t -> Ptime.t

mtime m is the last modification time of m.

val kind : t -> kind

kind m is the kind of member of m.

val pp : Format.formatter -> t -> unit

pp_member formats members a bit like ls -l does. The reported byte size is the File.decompressed_size.

val pp_long : Format.formatter -> t -> unit

pp_long is like pp but adds more information.

Limits

val max : int

max is 65535, the maximum number of members that can be encoded in a (non-ZIP64) ZIP archive.

val max_path_length : int

max_path_length is 65535, the maximal size for member paths in ZIP archives.

OCaml

Innovation. Community. Security.