Set IgnoreZeroBlocks to read both TARs in the download’s joined.tar.
dotnet add package RecursiveAI.OneArchiveRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using RecursiveAI.OneArchive.Tar; using var input = File.OpenRead( "joined.tar"); using var tar = new TarReader(input, new() { IgnoreZeroBlocks = true }); while (tar.GetNextEntry() is { } entry) Console.WriteLine(entry.Name);
Prints one entry from each archive, in stream order:
a.txt b.txt
Unzip the example, then dotnet run.
The download’s first TAR contains a.txt (Alpha), and the second contains b.txt (Beta). Both text files end in a newline. If you get only a.txt, make sure you passed IgnoreZeroBlocks = true to the TarReader you’re using.
To join your own plain TAR files, run cat a.tar b.tar > joined.tar on Linux or macOS, or copy /b a.tar+b.tar joined.tar in Windows Command Prompt.
Variations
Stop at the first end marker. In the snippet at the top, replace the reader construction with this to see the default behavior:
using var tar = new TarReader(input);a.txtRelated recipes
The short answer
Open the joined TAR stream with TarReader, set TarReaderOptions.IgnoreZeroBlocks to true, and call GetNextEntry() until it returns null. The reader skips the zero blocks that normally mark the end of a TAR and reaches the headers in the next one. It lists entries in stream order and doesn’t extract them.
Why does TAR stop after the first archive?
A TAR writer normally ends the archive with two 512-byte zero blocks and can add more zero padding to fill out a record. OneArchive’s default reader stops at the first zero block at a header position. If you simply append a second complete TAR, you leave that first end marker in the middle of the new file. There’s nothing wrong with the second TAR; the reader has already stopped before it gets there.
IgnoreZeroBlocks changes how the reader treats blocks where it expects the next header. It doesn’t remove zero bytes from file data or treat duplicate paths as one entry. If both source archives contain notes.txt, both entries can appear. Decide which one you need before using the listing to drive an extraction workflow.
Can I use the same option for a TAR with no end marker?
Yes, but choose the option that describes the file you have. IgnoreZeroBlocks is for reading past zero blocks and also makes RequireEndOfArchive irrelevant. If you have a single TAR that stops cleanly between entries without an end marker, set RequireEndOfArchive = false instead. With IgnoreZeroBlocks off, that still stops at a zero block if one is present. Neither option repairs a partial header or missing file data. See the TAR reader’s end-of-archive rules for how it handles these cases.