# How standard libraries read TAR files

3 TAR files from loremfile.dev, given to 5 standard-library readers in 10 runtime versions: which read them, which refuse, which differ.

The page: <https://loremfile.dev/compat/tar>.

3 TAR files given to 5 readers in 10 runtime versions. Cells of the ordinary files: reads 25, differs 0, refuses 0, crashes 0.

| File | Manifest says | go/archive/tar | go/archive/tar+compress/gzip | python/tarfile | ruby/Gem::Package::TarReader | ruby/Gem::Package::TarReader+Zlib::GzipReader | Java (no reader) | Node.js (no reader) |
|---|---|---|---|---|---|---|---|---|
| [`tar/3-text-files.tar`](https://loremfile.dev/tar/3-text-files.tar) (10.2 KB (10,240 bytes)) | directories 0, entries 3, uncompressed_bytes 2812 | **reads** reports directories 0, entries 3, uncompressed_bytes 2812 | not given this file | **reads** reports directories 0, entries 3, uncompressed_bytes 2812 | **reads** reports directories 0, entries 3, uncompressed_bytes 2812 | not given this file | **no-reader** | **no-reader** |
| [`tar/3-text-files.tar.gz`](https://loremfile.dev/tar/3-text-files.tar.gz) (1.2 KB (1,152 bytes)) | directories 0, entries 3, uncompressed_bytes 2705 | not given this file | **reads** reports directories 0, entries 3, uncompressed_bytes 2705 | **reads** reports directories 0, entries 3, uncompressed_bytes 2705 | not given this file | **reads** reports directories 0, entries 3, uncompressed_bytes 2705 | **no-reader** | **no-reader** |
| [`tar/3-text-files.tar.xz`](https://loremfile.dev/tar/3-text-files.tar.xz) (1.3 KB (1,268 bytes)) | directories 0, entries 3, uncompressed_bytes 2905 | **no-reader** | **no-reader** | **reads** reports directories 0, entries 3, uncompressed_bytes 2905 | **no-reader** | **no-reader** | **no-reader** | **no-reader** |

The manifest's compression decides what each tar reader is given. python/tarfile is given the file as it is, gzip and xz included, and decompresses it itself. archive/tar (Go) and Gem::Package::TarReader (Ruby) do not decompress, so each is given only uncompressed tar, compress/gzip or Zlib::GzipReader is chained into it for gzip-compressed tar (the arrangement Go's documentation describes) under its own reader id, and for xz-compressed tar neither Go nor Ruby has a reader: Go's standard library has bzip2, flate, gzip, lzw and zlib, and no xz.

Java has no reader for these files. The standard library has no tar reader: java.util.zip reads zip and gzip.

Node.js has no reader for these files. The standard library has no tar reader.

The results as JSON: <https://github.com/kumarprabhashanand/loremfile/blob/main/compat/results/tar.json>.
