https://github.com/enusbaum/enusbaum.torrent
A simple NuGet package for creating .torrent Files that can be used by most popular BitTorrent Clients
https://github.com/enusbaum/enusbaum.torrent
bencode bittorrent c-sharp dotnet nuget nuget-package torrent
Last synced: 4 months ago
JSON representation
A simple NuGet package for creating .torrent Files that can be used by most popular BitTorrent Clients
- Host: GitHub
- URL: https://github.com/enusbaum/enusbaum.torrent
- Owner: enusbaum
- License: mit
- Created: 2024-12-01T01:36:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-01T01:55:20.000Z (over 1 year ago)
- Last Synced: 2025-07-29T09:25:02.894Z (10 months ago)
- Topics: bencode, bittorrent, c-sharp, dotnet, nuget, nuget-package, torrent
- Language: C#
- Homepage:
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ENusbaum.Torrent - Simple NuGet to create .torrent files
`ENusbaum.Torrent` is a simple NuGet package that allows you to create .torrent files. It is a .NET Library built in C# utilizing dotnet9.
## Installation
To install `ENusbaum.Torrent`, run the following command in the Package Manager Console:
```
Install-Package ENusbaum.Torrent
```
## Usage
You have two options within `ENusbaum.Torrent` to create a .torrent file. You can either create a .torrent file as a ReadOnlySpan or have the library write the .torrent file to disk.
### Create a .torrent file as a ReadOnlySpan
```csharp
public ReadOnlySpan Create(string inputPath, string torrentName, string trackerAnnounceUrl, PieceSize pieceSize = PieceSize.Auto)
```
### Write the .torrent file to disk
```csharp
public bool CreateFile(string inputPath, string torrentName, string trackerAnnounceUrl, string outputFile, PieceSize pieceSize = PieceSize.Auto)
```
By default, all files in all subfolders of the specified `inputPath` will be included in the .torrent file created.
The default Piece Size of `Auto` will automatically determine the best piece size based on the size of the file being used to create the .torrent file with the optimal 2000 pieces. While there is some debate on the number
of pieces to use, 2000 is a good balance between the number of pieces and the size of the pieces.
Currently the maximum piece size supported by this NuGet is 16MiB, but can easily be extended if larger pieces are needed.