Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
/ libetar Public archive

LibeTar is a C# NuGet package that provides a simple way to extract files from TAR archives.

License

Notifications You must be signed in to change notification settings

lalakii/libetar

Repository files navigation

LibeTar -> Migrate to LibTar

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

libetar 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

Demo.cs

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

About

LibeTar is a C# NuGet package that provides a simple way to extract files from TAR archives.

Topics

Resources

License

Stars

Watchers

Forks