package tar-eio
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=f3d6b0d677fd40fd1eb80bccc60bb613220358be58f66c5fa8bf0257f3e5eb96
sha512=be23a0337f1334b9ead1516745f1397afd240787bb983f037ea33434eea7f0c9dedf2e53ebd1b47a076220cac9d926370d1b8d2b329d1e16d02b9b0e517dd162
doc/tar-eio/Tar_eio/index.html
Module Tar_eio
Source
Eio Tar
This library provides low-level and high-level abstractions for reading and writing Tar files using Eio.
type src =
| Flow : _ Eio.Flow.source -> src
| File : _ Eio.File.ro -> src
(*Sources for tar files
*)
Possible decoding errors
High-level Interface
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
.
Low-level Interface
Converts a normal result into Tar
s IO type
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