tar

Decode and encode tar format files in pure OCaml
README

tar is a simple library to read and write tar files with an emphasis on
streaming.

This is pure OCaml code, no C bindings.

Installation

tar can be installed with opam:

opam install tar
opam install tar-unix    # for use in Unix/Lwt
opam install tar-mirage  # for use in MirageOS

If you don't use opam consult the tar.opam file for build
instructions.

Example toplevel session

In utop:

utop # #require "tar";;
utop # #require "tar-unix";;

utop # let f = Lwt_unix.openfile "/tmp/foo.tar" [ Unix.O_RDONLY ] 0;;
val f : Lwt_unix.file_descr = <abstr>

utop # Lwt.bind f Tar_lwt_unix.Archive.list;;
[{Tar.Header.file_name = "_build/lib/tar.mli.depends";
  Tar.Header.file_mode = 420; Tar.Header.user_id = 1000;
  Tar.Header.group_id = 1000; Tar.Header.file_size = 21L;
  Tar.Header.mod_time = 1381080315L;
  Tar.Header.link_indicator = Tar.Header.Link.Normal;
  Tar.Header.link_name = ""};
 {Tar.Header.file_name = "_build/lib/tar_unix.mli.depends";
  Tar.Header.file_mode = 420; Tar.Header.user_id = 1000;
  Tar.Header.group_id = 1000; Tar.Header.file_size = 27L;
  Tar.Header.mod_time = 1381080318L;
  Tar.Header.link_indicator = Tar.Header.Link.Normal;
  Tar.Header.link_name = ""};
 {Tar.Header.file_name = "_build/lib/tar.mllib";
  Tar.Header.file_mode = ...; Tar.Header.user_id = ...;
  Tar.Header.group_id = ...; Tar.Header.file_size = ...;
  Tar.Header.mod_time = ...; Tar.Header.link_indicator = ...;
  Tar.Header.link_name = ...};
 ...]

Compressed tarball

The distribution gives a small implementation to create a tarball, a
compressed archive. The software allows to list the contents of a given
tarball. The compression is done with [decompress][decompress]. You can look at
the project documentation for more information on how to compress.

Alternatively, it is possible to use the Tar_gz module which offers the same
interface as Tar with compression.

Example users

This library is used by

  • xapi to read and write VM images

Documentation

The documentation and API reference is automatically generated by
ocamldoc from the interfaces. It can be consulted online.

Install
Published
28 Oct 2022
Maintainers
Sources
tar-2.2.1.tbz
sha256=43ce2007b87b5053783ab978258bdf65d5c1f6c8a92991253e9cad45e41fd52a
sha512=1d9923f924903e8d03462d1293de85affe2566ea4aed1cf0f49753901093a1252dda42b96d9000bf90e2b3a21b4ecc42e52ca065c404cc6124b3f53ab5aef611
Dependencies
odoc
with-doc
decompress
>= "1.5.1"
cstruct
>= "6.0.0"
ppx_cstruct
build & >= "3.6.0"
ocaml
>= "4.08.0"
dune
>= "2.9"
Reverse Dependencies
tar-mirage
>= "2.2.1"
tar-unix
< "1.0.1" | >= "2.2.1"
tezos-store
>= "13.0"
vpnkit
>= "0.1.1"