Library
Module
Module type
Parameter
Class
Class type
Unix I/O for tar-formatted data.
val pp_error : Stdlib.Format.formatter -> error -> unit
val value : ('a, 'err) Stdlib.result -> ('a, 'err, t) Tar.t
val fold :
(?global:Tar.Header.Extended.t -> Tar.Header.t -> 'a -> ('a, error, t) Tar.t) ->
string ->
'a ->
('a, error) Stdlib.result
fold 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.result
extract ~filter ~src dst
extracts the tar archive src
into the directory dst
. If dst
does not exist, it is created. If filter
is provided (defaults to fun _ -> true
), any file where filter hdr
returns false
, is skipped.
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.result
create ~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.result
header_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.result
append_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.result
write_header ~level hdr fd
writes the header hdr
to fd
.