The interactive file manager requires Javascript. Please enable it or use sftp or scp.
You may still browse the files here.

Download Latest Version LibTarDemo.zip (28.0 kB)
Email in envelope

Get an email when there's a new version of libtar

Home
Name Modified Size InfoDownloads / Week
1.2.6 2025-02-10
1.2.5 2025-02-03
README.md 2025-02-03 1.3 kB
Totals: 3 Items   1.3 kB 0

LibTar

Available on NuGet https://www.nuget.org/packages?q=libtar

libtar is a lightweight C# library for extracting TAR archives. It provides a simple API to extract all files from TAR archives.

API

Tar.ExtractAll(Stream src, string outputDirectory, bool overrideIfExisting);

Tar.Archive(string inputDirectory, Stream dest); // Create Tar Archive.

Demo

using CN.Lalaki.Archive;
using System.IO;
using System;

// ...sample code

using (var tar = File.Create("path\\of\\output.example.tar")){ // create tar archive.
    Tar.Archive("D:\\temp", tar);
}

using (var tar = File.OpenRead("path\\of\\example.tar")) // tar file extract.
{
    Tar.ExtractAll(tar, "path\\of\\outputDir\\", true);
}

using (var targz = File.OpenRead("path\\of\\example.tar.gz")) // tar.gz file extract
{
    Tar.ExtractAll(targz, "path\\of\\outputDir\\", true);
}

using (var targz = new GzipStream(..., CompressionMode.Decompress)) // tar.gz stream extract
{
    Tar.ExtractAll(targz, "path\\of\\outputDir\\", true);
}

License

MIT

Source: README.md, updated 2025-02-03