Tar_unixUnix I/O for tar-formatted data.
type error = [ | `Fatal of Tar.error| `Unix of Unix.error * string * string| `Unexpected_end_of_file| `Msg of string ]val pp_error : Stdlib.Format.formatter -> error -> unitval fold :
(?global:Tar.Header.Extended.t -> Tar.Header.t -> 'a -> ('a, error, t) Tar.t) ->
string ->
'a ->
('a, error) Stdlib.resultfold f filename acc folds over the tar archive. The function f is called for each hdr : Tar.Header.t. It should forward the position in the file descriptor by hdr.Tar.Header.file_size.
val extract :
?filter:(Tar.Header.t -> bool) ->
src:string ->
string ->
(unit, [> `Exn of exn | error ]) Stdlib.resultextract ~filter ~src dst extracts the tar archive src into the directory dst. If filter is provided (defaults to fun _ -> true), any file where filter hdr returns false, is skipped. No directories are created including dst and any (implicit or explicit) directories in the archive.
val create :
?level:Tar.Header.compatibility ->
?global:Tar.Header.Extended.t ->
?filter:(Tar.Header.t -> bool) ->
src:string ->
string ->
(unit, [ `Msg of string | `Unix of Unix.error * string * string ])
Stdlib.resultcreate ~level ~filter ~src dst creates a tar archive at dst. It uses src, a directory name, as input. If filter is provided (defaults to fun _ -> true), any file where filter hdr returns false is skipped.
val header_of_file :
?level:Tar.Header.compatibility ->
string ->
(Tar.Header.t, [ `Msg of string | `Unix of Unix.error * string * string ])
Stdlib.resultheader_of_file ~level filename returns the tar header of filename.
val append_file :
?level:Tar.Header.compatibility ->
?header:Tar.Header.t ->
string ->
Unix.file_descr ->
(unit, [ `Msg of string | `Unix of Unix.error * string * string ])
Stdlib.resultappend_file ~level ~header filename fd appends the contents of filename to the tar archive fd. If header is not provided, header_of_file is used for constructing a header.
val write_header :
?level:Tar.Header.compatibility ->
Tar.Header.t ->
Unix.file_descr ->
(unit, [ `Msg of string | `Unix of Unix.error * string * string ])
Stdlib.resultwrite_header ~level hdr fd writes the header hdr to fd.
val write_global_extended_header :
?level:Tar.Header.compatibility ->
Tar.Header.Extended.t ->
Unix.file_descr ->
(unit, [ `Msg of string | `Unix of Unix.error * string * string ])
Stdlib.resultwrite_global_extended_header ~level hdr fd writes the extended header hdr to fd.