Library
Module
Module type
Parameter
Class
Class type
This library provides low-level and high-level abstractions for reading and writing Tar files using Eio.
Possible decoding errors
run tar src
will run the given tar
using Eio
on src
.
val extract :
?filter:(Tar.Header.t -> bool) ->
src ->
Eio.Fs.dir_ty Eio.Path.t ->
(unit, [> decode_error ]) result
extract src dst
extracts the tar file from src
into dst
. For example:
Eio.Path.with_open_in src @@ fun src ->
Tar_eio.extract src dst
will extract the file at src
into the directory at dst
. Note that this function only creates files, directories and symlinks with the correct mode (it does not, for example, set the ownership of the files according to the tar file).
val create :
?level:Tar.Header.compatibility ->
?global:Tar.Header.Extended.t ->
?filter:(Tar.Header.t -> bool) ->
src:Eio.Fs.dir_ty Eio.Path.t ->
_ Eio.Flow.sink ->
(unit, [> decode_error ]) result
create ~src dst
is the opposite of extract
. The path src
is tarred into dst
.
val fold :
(?global:Tar.Header.Extended.t ->
Tar.Header.t ->
'acc ->
('acc, [> `Fatal of Tar.error | `Unexpected_end_of_file ] as 'b, t) Tar.t) ->
src ->
'acc ->
('acc, 'b) result
fold f src init
folds over the tarred src
.
val append_file :
?level:Tar.Header.compatibility ->
?header:Tar.Header.t ->
Eio.Fs.dir_ty Eio.Path.t ->
_ Eio.Flow.sink ->
(unit, [> decode_error ]) result
append_file dst sink
val header_of_file :
?level:Tar.Header.compatibility ->
?getpwuid:(int64 -> string) ->
?getgrgid:(int64 -> string) ->
Eio.Fs.dir_ty Eio.Path.t ->
Tar.Header.t
Return the header needed for a particular file on disk. getpwuid
and getgrgid
are optional functions that should take the uid and gid respectively and return the passwd and group entry names for each. These will be added to the header.
val write_header :
?level:Tar.Header.compatibility ->
Tar.Header.t ->
_ Eio.Flow.sink ->
(unit, [> decode_error ]) result
val write_global_extended_header :
?level:Tar.Header.compatibility ->
Tar.Header.Extended.t ->
_ Eio.Flow.sink ->
(unit, [> decode_error ]) result
val write_end : _ Eio.Flow.sink -> unit