TarTar utilities
v3.3.0 - homepage
The type of errors that may occur.
val pp_error : Stdlib.Format.formatter -> [< error ] -> unitpp_error ppf e pretty prints the error e on the formatter ppf.
module Header : sig ... endProcess and create tar file headers.
val decode_state : ?global:Header.Extended.t -> unit -> decode_statedecode_state ~global () constructs a decode_state.
val decode :
decode_state ->
string ->
(decode_state
* [ `Read of int | `Skip of int | `Header of Header.t ] option
* Header.Extended.t option,
[ `Eof | `Fatal of error ])
Stdlib.resultdecode t data decodes data taking the current state t into account. It may result on success in a new state, optionally some action that should be done (`Read or `Skip), or a decoded `Header. Possibly a new global PAX header is provided as well.
If no `Read or `Skip is returned, the new state should be used with decode with the next Header.length sized string, which will lead to further decoding until `Eof (or an error) occurs.
val encode_header :
?level:Header.compatibility ->
Header.t ->
(string list, [> `Msg of string ]) Stdlib.resultencode_header ~level hdr encodes the header with the provided level (defaults to V7) into a list of strings to be written to the disk. Once a header is written, the payload (padded to multiples of Header.length) should follow.
val encode_global_extended_header :
?level:Header.compatibility ->
Header.Extended.t ->
(string list, [> `Msg of string ]) Stdlib.resultencode_global_extended_header hdr encodes the global extended header as a list of strings.
fold.fold produces a ('a, 'err, 't) t value which can be evaluated by a scheduler (such as lwt or unix). This value describe when we require to Read (like Stdlib.input), Really_read (like Stdlib.really_read) and Seek (like Stdlib.seek_in).
We can compose these actions with Bind, Return and High. The latter allows you to use a value ('a, 't) io that comes from the scheduler used - so you can use an Lwt value ('a Lwt.t) without depending on Lwt (('a, lwt) t) at this stage.
For further informations, you can look at the paper about Lightweight Higher Kind Polymorphism available here.
type ('a, 'err, 't) t = | Really_read : int -> (string, 'err, 't) t| Read : int -> (string, 'err, 't) t| Seek : int -> (unit, 'err, 't) t| Bind : ('a, 'err, 't) t * ('a -> ('b, 'err, 't) t) -> ('b, 'err, 't) t| Return : ('a, 'err) Stdlib.result -> ('a, 'err, 't) t| High : (('a, 'err) Stdlib.result, 't) io -> ('a, 'err, 't) t| Write : string -> (unit, 'err, 't) tval really_read : int -> (string, _, _) tval read : int -> (string, _, _) tval seek : int -> (unit, _, _) tval return : ('a, 'err) Stdlib.result -> ('a, 'err, _) tval write : string -> (unit, _, _) tmodule Syntax : sig ... endDeprecated. Use Tar.bind or Tar.Syntax.( let* )
type ('a, 'err, 't) fold =
(?global:Header.Extended.t -> Header.t -> 'a -> ('a, 'err, 't) t) ->
'a ->
('a, 'err, 't) tfold f is a _ t that reads an archive and executes f on each header. f is expected to either read or skip the file contents, or return an error.
type ('err, 't) content = unit -> (string option, 'err, 't) ttype ('err, 't) entry =
Header.compatibility option * Header.t * ('err, 't) contentval out :
?level:Header.compatibility ->
?global_hdr:Header.Extended.t ->
([> `Msg of string ] as 'err, 't) entries ->
(unit, 'err, 't) tout hdr entries is a _ t that writes entries into an archive. hdr is the global header and each entry must come from a content stream and the associated header.