![]() |
VOOZH | about |
dotnet add package BirdMessenger --version 4.0.0
NuGet\Install-Package BirdMessenger -Version 4.0.0
<PackageReference Include="BirdMessenger" Version="4.0.0" />
<PackageVersion Include="BirdMessenger" Version="4.0.0" />Directory.Packages.props
<PackageReference Include="BirdMessenger" />Project file
paket add BirdMessenger --version 4.0.0
#r "nuget: BirdMessenger, 4.0.0"
#:package BirdMessenger@4.0.0
#addin nuget:?package=BirdMessenger&version=4.0.0Install as a Cake Addin
#tool nuget:?package=BirdMessenger&version=4.0.0Install as a Cake Tool
<div style="text-align: left"><img src="docs/img/logo.png" height="120px">
"Our aim is to solve the problem of unreliable file uploads once and for all. tus is a new open protocol for resumable uploads built on HTTP. It offers simple, cheap and reusable stacks for clients and servers. It supports any language, any platform and any network." - https://tus.io
BirdMessenger 中文名为:青鸟——相传为西王母的信使。 BirdMessnger 是一个基于.NET Standard 的 Tus协议的实现客户端。
Package manager
Install-Package BirdMessenger -Version 4.0.0
.NET CLI
dotnet add package BirdMessenger --version 4.0.0
public static Uri TusEndpoint = new Uri("http://localhost:5094/files");
static async Task Main(string[] args)
{
await DemoUseTusClientByDependencyInjection();
await DemoUseHttpClient();
}
/// <summary>
/// recommend using DependencyInjection
/// </summary>
private static async Task DemoUseTusClientByDependencyInjection()
{
var services = new ServiceCollection();
services.AddHttpClient<ITusClient, TusClient>(); // configure httpClient ,refer to https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests
var serviceProvider = services.BuildServiceProvider();
var tusClient = serviceProvider.GetService<ITusClient>();
var location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
// file to be uploaded
FileInfo fileInfo = new FileInfo(Path.Combine(location, @"TestFile/test.txt"));
using var fileStream = new FileStream(fileInfo.FullName,FileMode.Open,FileAccess.Read);
MetadataCollection metadata = new MetadataCollection();
metadata["filename"] = fileInfo.Name;
TusCreateRequestOption tusCreateRequestOption = new TusCreateRequestOption()
{
Endpoint = TusEndpoint,
Metadata = metadata,
UploadLength = fileStream.Length
};
var resp = await tusClient.TusCreateAsync(tusCreateRequestOption, CancellationToken.None);
TusPatchRequestOption tusPatchRequestOption = new TusPatchRequestOption
{
FileLocation = resp.FileLocation,
Stream = fileStream,
//UploadBufferSize = 2*1024*1024, // upload size ,default value is 1MB
//UploadType = UploadType.Chunk, // setting upload file with Stream or chunk ,default value is Stream
OnProgressAsync = x =>
{
var uploadedProgress = (int)Math.Floor(100 * (double)x.UploadedSize / x.TotalSize);
Console.WriteLine($"OnProgressAsync-TotalSize:{x.TotalSize}-UploadedSize:{x.UploadedSize}-uploadedProgress:{uploadedProgress}");
return Task.CompletedTask;
},
OnCompletedAsync = x =>
{
var reqOption = x.TusRequestOption as TusPatchRequestOption;
Console.WriteLine($"File:{reqOption.FileLocation} Completed ");
return Task.CompletedTask;
},
OnFailedAsync = x =>
{
Console.WriteLine($"error: {x.Exception.Message}");
if (x.OriginHttpRequestMessage is not null)
{
//log httpRequest
}
if (x.OriginResponseMessage is not null)
{
//log response
}
return Task.CompletedTask;
}
};
var tusPatchResp = await tusClient.TusPatchAsync(tusPatchRequestOption, CancellationToken.None);
}
/// <summary>
/// using httpclient directly
/// </summary>
private static async Task DemoUseHttpClient()
{
using var httpClient = new HttpClient();
var location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
// file to be uploaded
FileInfo fileInfo = new FileInfo(Path.Combine(location, @"TestFile/test.txt"));
var fileStream = new FileStream(fileInfo.FullName,FileMode.Open,FileAccess.Read);
MetadataCollection metadata = new MetadataCollection();
metadata["filename"] = fileInfo.Name;
TusCreateRequestOption tusCreateRequestOption = new TusCreateRequestOption()
{
Endpoint = TusEndpoint,
Metadata = metadata,
UploadLength = fileStream.Length
};
var resp = await httpClient.TusCreateAsync(tusCreateRequestOption, CancellationToken.None);
bool isInvokeOnProgressAsync = false;
bool isInvokeOnCompletedAsync = false;
long uploadedSize = 0;
TusPatchRequestOption tusPatchRequestOption = new TusPatchRequestOption
{
FileLocation = resp.FileLocation,
Stream = fileStream,
//UploadBufferSize = 2*1024*1024, // upload size ,default value is 1MB
//UploadType = UploadType.Chunk, // setting upload file with Stream or chunk ,default value is Stream
OnProgressAsync = x =>
{
isInvokeOnProgressAsync = true;
uploadedSize = x.UploadedSize;
var uploadedProgress = (int)Math.Floor(100 * (double)x.UploadedSize / x.TotalSize);
Console.WriteLine($"OnProgressAsync-TotalSize:{x.TotalSize}-UploadedSize:{x.UploadedSize}-uploadedProgress:{uploadedProgress}");
return Task.CompletedTask;
},
OnCompletedAsync = x =>
{
isInvokeOnCompletedAsync = true;
var reqOption = x.TusRequestOption as TusPatchRequestOption;
Console.WriteLine($"File:{reqOption.FileLocation} Completed ");
return Task.CompletedTask;
},
OnFailedAsync = x =>
{
Console.WriteLine($"error: {x.Exception.Message}");
if (x.OriginHttpRequestMessage is not null)
{
//log httpRequest
}
if (x.OriginResponseMessage is not null)
{
//log response
}
return Task.CompletedTask;
}
};
var tusPatchResp = await httpClient.TusPatchAsync(tusPatchRequestOption, CancellationToken.None);
}
Development is done on the 'master' branch.
<a href="https://www.jetbrains.com" target="_blank"> <img src="./docs/img/jetbrains_logo.png" title="JetBrains" width="100" /> </a>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 is compatible. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on BirdMessenger:
| Package | Downloads |
|---|---|
|
Hopex.ApplicationServer.Extensions.Package
Hopex Application Server Packager |
|
|
Supabase.Storage
A C# implementation of the Supabase Storage client |
|
|
Meshmakers.Octo.Sdk.ServiceClient
Client side proxies to communicate with octo mesh services. |
|
|
Codehard.FileService.Client
A client library for Codehard's File Service. |
|
|
TheFusionWorks.Platforms
These are base utility classes developed by The Fusion Works which other packages and applications are built off. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 4.0.0 | 1,738 | 6/6/2026 | |
| 4.0.0-preview.1 | 471 | 2/8/2026 | |
| 4.0.0-beta1 | 103 | 4/7/2026 | |
| 3.1.4 | 68,507 | 10/28/2024 | |
| 3.1.3 | 13,187 | 5/21/2024 | |
| 3.1.2 | 40,444 | 10/7/2023 | |
| 3.1.1 | 2,570 | 8/14/2023 | |
| 3.1.0 | 17,198 | 11/27/2022 | |
| 3.0.2 | 1,101 | 11/8/2022 | |
| 3.0.1 | 818 | 11/8/2022 | 3.0.1 is deprecated. |
| 3.0.0 | 1,298 | 10/17/2022 | 3.0.0 is deprecated. |
| 3.0.0-beta1 | 511 | 8/14/2022 | 3.0.0-beta1 is deprecated. |
| 2.2.1 | 126,704 | 6/11/2022 | |
| 2.2.0 | 4,974 | 3/6/2022 | |
| 2.1.0-bata | 496 | 10/17/2021 | |
| 2.0.1 | 315,631 | 3/2/2021 | |
| 2.0.0 | 338,036 | 10/23/2020 | |
| 1.0.1 | 755 | 7/26/2020 | |
| 0.1.6 | 786 | 11/18/2019 | |
| 0.1.5 | 1,067 | 11/17/2019 | 0.1.5 is deprecated. |