package tar

  1. Overview
  2. Docs
Decode and encode tar format files in pure OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

tar-3.1.1.tbz
sha256=a58907f52b89af16109359432ff84d24f6a26460a70e58030bd0fc7cca4db054
sha512=d6752890c2a259108d8a204af78ab7382a63bf06d5c0382cc5342c258aba8f6972ba4761f64a7f1f86c51b7ed82963cd6c5fbdf3e8eaea71ae1e6d946221ae56

Description

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

This is pure OCaml code, no C bindings.

Tags

org:xapi-project org:mirage

Published: 13 Sep 2024

README

tar — decode and encode tar files

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

  • obuilder to copy files extensively.

Documentation

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

Dependencies (3)

  1. decompress >= "1.5.1"
  2. ocaml >= "4.08.0"
  3. dune >= "2.9"

Dev Dependencies (1)

  1. odoc with-doc

Used by (8)

  1. builder-web >= "0.2.0"
  2. octez-shell-libs
  3. octez-smart-rollup-node-lib >= "19.0"
  4. tar-eio = "3.1.1"
  5. tar-mirage = "3.1.1"
  6. tar-unix < "0.9.0" | = "3.1.1"
  7. tezos-store >= "13.0"
  8. vpnkit >= "0.1.1"

Conflicts

None

OCaml

Innovation. Community. Security.