SpawnDev.BlazorJS.WebTorrents
1.6.3
dotnet add package SpawnDev.BlazorJS.WebTorrents --version 1.6.3
NuGet\Install-Package SpawnDev.BlazorJS.WebTorrents -Version 1.6.3
<PackageReference Include="SpawnDev.BlazorJS.WebTorrents" Version="1.6.3" />
paket add SpawnDev.BlazorJS.WebTorrents --version 1.6.3
#r "nuget: SpawnDev.BlazorJS.WebTorrents, 1.6.3"
// Install SpawnDev.BlazorJS.WebTorrents as a Cake Addin #addin nuget:?package=SpawnDev.BlazorJS.WebTorrents&version=1.6.3 // Install SpawnDev.BlazorJS.WebTorrents as a Cake Tool #tool nuget:?package=SpawnDev.BlazorJS.WebTorrents&version=1.6.3
SpawnDev.BlazorJS.WebTorrents
SpawnDev.BlazorJS.WebTorrents brings the amazing WebTorrent library to Blazor WebAssembly.
WebTorrent is a streaming torrent client for node.js and the browser. YEP, THAT'S RIGHT. THE BROWSER. It's written completely in JavaScript � the language of the web � so the same code works in both runtimes.
Demo
Documentation
SpawnDev.BlazorJS.WebTorrents is a collection of JSObject wrappers that allow access to the Javascript WebTorrent library. The interfaces are nearly identical. Intellisense documentation is included.
Getting started
Example Program.cs
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using SpawnDev.BlazorJS;
using SpawnDev.BlazorJS.WebTorrents;
using SpawnDev.BlazorJS.WebTorrents.Demo;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
// Add BlazorJSRunAsync service
builder.Services.AddBlazorJSRuntime();
// Add WebTorrentService service
builder.Services.AddWebTorrentService();
// initialize BlazorJSRuntime to start app
await builder.Build().BlazorJSRunAsync();
Inject
[Inject] WebTorrentService WebTorrentService { get; set; }
WebTorrentService.Client is an instance of WebTorrent
Very basic example that adds a torrent magnet, waits for the torrent metadata to be retrieved and shows information about the torrents files. Then, the torrent and all related data is destroyed.
var bigBuckBunnyMagnet = "magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fbig-buck-bunny.torrent";
// add a torrent (only looking to get metadata here, so add it with the Deselect option set to true)
using var torrent = WebTorrentService.Client!.Add(bigBuckBunnyMagnet, new AddTorrentOptions { Deselect = true });
// wait for the torrent metadata to load
await torrent.WhenReady();
// show some torrent info
Console.WriteLine($"InfoHash: {torrent.InfoHash}");
Console.WriteLine($"Files: {torrent.Files.Length}");
foreach (File file in torrent.Files)
{
Console.WriteLine($"File: {file.Name} {file.Size}");
}
// destory the torrent and related resources
await torrent.DestroyAsync(new DestroyTorrentOptions { DestroyStore = true });
Screenshots of demo app
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 is compatible. 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 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 is compatible. |
-
net6.0
- Microsoft.AspNetCore.Components.WebAssembly (>= 6.0.25)
- SpawnDev.BlazorJS (>= 2.5.30)
- System.Text.Json (>= 6.0.11)
-
net7.0
- Microsoft.AspNetCore.Components.WebAssembly (>= 7.0.14)
- SpawnDev.BlazorJS (>= 2.5.30)
- System.Text.Json (>= 7.0.4)
-
net8.0
- Microsoft.AspNetCore.Components.WebAssembly (>= 8.0.1)
- SpawnDev.BlazorJS (>= 2.5.30)
- System.Text.Json (>= 8.0.5)
-
net9.0
- Microsoft.AspNetCore.Components.WebAssembly (>= 9.0.0)
- SpawnDev.BlazorJS (>= 2.5.30)
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 |
---|---|---|
1.6.3 | 86 | 12/4/2024 |
1.6.2 | 88 | 11/29/2024 |
1.6.1 | 49 | 11/4/2024 |
1.6.0 | 66 | 10/11/2024 |
1.5.1 | 105 | 8/1/2024 |
1.5.0 | 74 | 7/26/2024 |
1.4.1 | 113 | 7/23/2024 |
1.4.0 | 115 | 7/17/2024 |
1.3.2 | 112 | 7/4/2024 |
1.3.1 | 107 | 6/26/2024 |
1.3.0 | 102 | 6/24/2024 |
1.2.1 | 125 | 6/18/2024 |
1.2.0 | 100 | 6/12/2024 |
1.1.3 | 120 | 6/1/2024 |
1.1.2 | 116 | 6/1/2024 |
1.1.1 | 121 | 5/31/2024 |
1.1.0 | 112 | 4/11/2024 |
1.0.10 | 125 | 4/4/2024 |
1.0.8 | 111 | 4/3/2024 |
1.0.7 | 118 | 4/3/2024 |
1.0.6 | 116 | 4/2/2024 |
1.0.5 | 124 | 3/29/2024 |
1.0.4 | 124 | 3/29/2024 |
1.0.3 | 124 | 3/27/2024 |
1.0.2 | 112 | 3/27/2024 |
1.0.1 | 117 | 3/26/2024 |
1.0.0 | 147 | 3/25/2023 |