TapeArchive 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TapeArchive --version 1.1.0                
NuGet\Install-Package TapeArchive -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TapeArchive" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TapeArchive --version 1.1.0                
#r "nuget: TapeArchive, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TapeArchive as a Cake Addin
#addin nuget:?package=TapeArchive&version=1.1.0

// Install TapeArchive as a Cake Tool
#tool nuget:?package=TapeArchive&version=1.1.0                

TapeArchive

Nuget

Usage

Before using this library you need to understand some basic of TAR structure. DO NOT SKIP THIS otherwise you won't known how to properly working with this library.

TAR is acronym for Tape Archive. It was designed for writing and reading to/from a tape drive. That mean its structure was designed for sequential access, not random access. If you want to seek to a specific file in a TAR what most library actually do is keep reading and discard all data until it reach that file. And TAR does not support compression by itself. The compression you see like file.tar.gz is just a TAR that compressed witgh GZIP later.

TAR format have a lot of variants:

  1. Original TAR that shipped with AT&T UNIX Version 7
  2. Pre-POSIX (AKA. POSIX.1-1988 draft)
  3. POSIX.1-1988 (AKA. ustar)
  4. pax (AKA. POSIX.1-2001)
  5. GNU
  6. Solaris
  7. AIX
  8. macOS

Usually most reader will be able to extract any variants. This library currently support up to ustar. But just as I said before that most reader will be able to extract any variants, including this library. So you should not have any problem when reading. For writing try to stick with original or ustar. Usually original variant will be able to suite you need in most cases.

Reading

using TapeArchive;

await using var reader = new TapeArchive(stream, true);

await foreach (var item in reader.ReadAsync())
{
    // Do something with item.
}

Writing

using System;
using TapeArchive;

await using var builder = new ArchiveBuilder(stream, true);

await builder.WriteItemAsync(new(ItemType.RegularFile, new("./file1"))
{
    Content = content,
    Size = size,
    ModificationTime = DateTime.Now,
});

// The builder must be disposed to complete the archive even if no item has been written.

Development

Prerequisites

  • .NET 6 SDK

Build

dotnet build src/TapeArchive.sln

Run tests

dotnet test src/TapeArchive.sln

License

MIT

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on TapeArchive:

Package Downloads
CreativeCoders.IO

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.1 2,026 5/18/2022
3.0.0 431 5/17/2022
2.0.0 445 4/27/2022
1.1.0 454 4/5/2022
1.0.0 437 4/3/2022