8000 GitHub - lalakii/libtar: LibTar is a C# NuGet package that provides a simple way to archive or extract files from TAR archives.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ libtar Public

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

License

Notifications You must be signed in to change notification settings

lalakii/libtar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LibTar

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

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

API

Tar.ExtractAll(Stream src, string outputDirectory, bool overrideIfExisting); // Extract Tar or Tar.Gz

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

0