TorrentUtils 0.1.0
dotnet add package TorrentUtils --version 0.1.0
NuGet\Install-Package TorrentUtils -Version 0.1.0
<PackageReference Include="TorrentUtils" Version="0.1.0" />
<PackageVersion Include="TorrentUtils" Version="0.1.0" />
<PackageReference Include="TorrentUtils" />
paket add TorrentUtils --version 0.1.0
#r "nuget: TorrentUtils, 0.1.0"
#:package TorrentUtils@0.1.0
#addin nuget:?package=TorrentUtils&version=0.1.0
#tool nuget:?package=TorrentUtils&version=0.1.0
TorrentUtils
TorrentUtils is a C# rewrite of airium/TorrentUtils. It provides BitTorrent metadata APIs for parsing, writing, hashing, top-level metadata rewriting, and payload verification.
The library is focused on BEP 3 / v1 torrent metadata. It also exposes a lightweight meta version probe so callers can identify v2 metadata before choosing a parsing path.
Install
dotnet add package TorrentUtils
Basic Usage
Read metadata and compute the v1 info hash:
using TorrentUtils;
using var torrent = new Torrent();
torrent.ReadTorrentFile("sample.torrent");
Console.WriteLine(torrent.Name);
Console.WriteLine(torrent.ComputeInfoHashHex());
foreach (var file in torrent.FileList)
{
Console.WriteLine($"{file.RelativePath} {file.Size}");
}
Create a v1 torrent from a file or directory:
using TorrentUtils;
using var torrent = new Torrent(pieceLength: 4 * 1024 * 1024);
torrent.SetTrackerList(["https://tracker.example/announce"]);
torrent.SetCreatedBy("TorrentUtils");
await torrent.LoadFromPathAsync(new DirectoryInfo("payload"));
torrent.WriteTorrentFile("payload.torrent");
Verify payload bytes against an existing torrent:
using TorrentUtils;
using var torrent = new Torrent();
torrent.ReadTorrentFile("payload.torrent");
IReadOnlyList<int> failedPieces = torrent.Verify("payload");
Probe the torrent metadata version:
using TorrentUtils;
int version = TorrentVersion.ReadMetaVersionFromFile("sample.torrent");
bool isV2 = TorrentVersion.IsV2FromFile("sample.torrent");
Rewrite top-level metadata without changing the info dictionary:
using TorrentUtils;
var update = new TorrentTopLevelUpdate();
update.SetComment("Updated comment");
update.SetCreatedBy("TorrentUtils");
TorrentTopLevelRewriter.RewriteFile("input.torrent", "output.torrent", update);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 51 | 7/7/2026 |