Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mirage/ocaml-tar
Pure OCaml library to read and write tar files
https://github.com/mirage/ocaml-tar
Last synced: about 1 month ago
JSON representation
Pure OCaml library to read and write tar files
- Host: GitHub
- URL: https://github.com/mirage/ocaml-tar
- Owner: mirage
- License: isc
- Created: 2012-03-22T17:38:47.000Z (over 12 years ago)
- Default Branch: main
- Last Pushed: 2024-08-07T12:44:39.000Z (about 1 month ago)
- Last Synced: 2024-08-07T15:26:22.162Z (about 1 month ago)
- Language: OCaml
- Homepage:
- Size: 1.45 MB
- Stars: 54
- Watchers: 19
- Forks: 33
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE.md
Awesome Lists containing this project
README
## tar — decode and encode tar files
[![OCaml-CI Build Status](https://img.shields.io/endpoint?url=https://ci.ocamllabs.io/badge/mirage/ocaml-tar/main&logo=ocaml)](https://ci.ocamllabs.io/github/mirage/ocaml-tar)
[![GitHub Actions Build Status](https://github.com/mirage/ocaml-tar/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/mirage/ocaml-tar/actions)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 MirageOSIf you don't use `opam` consult the [`tar.opam`](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 =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.[decompress]: https://github.com/mirage/decompress
## Example users
This library is used by
* [xapi](https://github.com/xapi-project/xen-api) to read and write VM images;
* [obuilder](https://github.com/ocurrent/obuilder) to copy files extensively.## Documentation
The documentation and API reference is automatically generated by
`odoc` from the interfaces. It can be consulted [online][2].[2]: https://mirage.github.io/ocaml-tar/