package tar-eio

  1. Overview
  2. Docs
Decode and encode tar format files using Eio

Install

Dune Dependency

Authors

Maintainers

Sources

tar-3.3.0.tbz
sha256=f3d6b0d677fd40fd1eb80bccc60bb613220358be58f66c5fa8bf0257f3e5eb96
sha512=be23a0337f1334b9ead1516745f1397afd240787bb983f037ea33434eea7f0c9dedf2e53ebd1b47a076220cac9d926370d1b8d2b329d1e16d02b9b0e517dd162

doc/tar-eio/Tar_eio/index.html

Module Tar_eioSource

Eio Tar

This library provides low-level and high-level abstractions for reading and writing Tar files using Eio.

Sourcetype t
Sourcetype src =
  1. | Flow : _ Eio.Flow.source -> src
  2. | File : _ Eio.File.ro -> src
    (*

    Sources for tar files

    *)
Sourcetype decode_error = [
  1. | `Fatal of Tar.error
  2. | `Unexpected_end_of_file
  3. | `Msg of string
]

Possible decoding errors

High-level Interface

Sourceval run : ('a, [> `Unexpected_end_of_file ] as 'b, t) Tar.t -> src -> ('a, 'b) result

run tar src will run the given tar using Eio on src.

Sourceval 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).

  • parameter filter

    Can be used to exclude certain entries based on their header.

Sourceval 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.

  • parameter filter

    Can be used to exclude certain entries based on their header.

Sourceval 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

Sourceval value : ('a, 'err) result -> ('a, 'err, t) Tar.t

Converts a normal result into Tars IO type

Sourceval 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

Sourceval 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.

Sourceval write_header : ?level:Tar.Header.compatibility -> Tar.Header.t -> _ Eio.Flow.sink -> (unit, [> decode_error ]) result
Sourceval write_global_extended_header : ?level:Tar.Header.compatibility -> Tar.Header.Extended.t -> _ Eio.Flow.sink -> (unit, [> decode_error ]) result
Sourceval write_end : _ Eio.Flow.sink -> unit
OCaml

Innovation. Community. Security.