TapeArchive 3.0.0
See the version list below for details.
dotnet add package TapeArchive --version 3.0.0
NuGet\Install-Package TapeArchive -Version 3.0.0
<PackageReference Include="TapeArchive" Version="3.0.0" />
paket add TapeArchive --version 3.0.0
#r "nuget: TapeArchive, 3.0.0"
// Install TapeArchive as a Cake Addin #addin nuget:?package=TapeArchive&version=3.0.0 // Install TapeArchive as a Cake Tool #tool nuget:?package=TapeArchive&version=3.0.0
TapeArchive
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:
- Original TAR that shipped with AT&T UNIX Version 7
- Pre-POSIX (AKA. POSIX.1-1988 draft)
- POSIX.1-1988 (AKA. ustar)
- pax (AKA. POSIX.1-2001)
- GNU
- Solaris
- AIX
- 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 ustar due to some reader like GNU Tar does not handle file mode properly for origial variant.
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);
var item = new UstarItem(PrePosixType.RegularFile, new("./file1"))
{
Content = content,
Size = size,
};
await builder.WriteItemAsync(item, null);
await builder.CompleteAsync();
Breaking changes
2.0 to 3.0
IArchiveBuilder.WriteItemAsync
has been added a parameter to specify how to create parent entries.
1.0 to 2.0
Disposing of IArchiveBuilder
is changed. In 1.0 it will complete the archive. For 2.0 it will abort the archive if archive is not completed with
CompleteAsync
. The aborted archive is a broken TAR and cannot be read by any TAR readers.
Development
Prerequisites
- Latest .NET SDK
Build
dotnet build src/TapeArchive.sln
Run tests
dotnet test src/TapeArchive.sln
License
MIT
Product | Versions 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. |
-
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.