Tar_lwt_unixLwt_unix I/O for tar-formatted data
type decode_error = [ | `Fatal of Tar.error| `Unix of Unix.error * string * string| `Unexpected_end_of_file| `Msg of string ]val pp_decode_error : Stdlib.Format.formatter -> decode_error -> unitval run :
('a, [> decode_error ] as 'b, t) Tar.t ->
Lwt_unix.file_descr ->
('a, 'b) Stdlib.result Lwt.tval fold :
(?global:Tar.Header.Extended.t ->
Tar.Header.t ->
'a ->
('a, [> decode_error ] as 'err, t) Tar.t) ->
string ->
'a ->
('a, 'err) Stdlib.result Lwt.tfold 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 | decode_error ]) Stdlib.result Lwt.textract ~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.result
Lwt.tcreate ~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
Lwt.theader_of_file ~level filename returns the tar header of filename.
val append_file :
?level:Tar.Header.compatibility ->
?header:Tar.Header.t ->
string ->
Lwt_unix.file_descr ->
(unit, [ `Msg of string | `Unix of Unix.error * string * string ])
Stdlib.result
Lwt.tappend_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 ->
Lwt_unix.file_descr ->
(unit, [ `Msg of string | `Unix of Unix.error * string * string ])
Stdlib.result
Lwt.twrite_header ~level hdr fd writes the header hdr to fd.
val write_global_extended_header :
?level:Tar.Header.compatibility ->
Tar.Header.Extended.t ->
Lwt_unix.file_descr ->
(unit, [ `Msg of string | `Unix of Unix.error * string * string ])
Stdlib.result
Lwt.twrite_global_extended_header ~level hdr fd writes the extended header hdr to fd.