BirdMessenger 3.0.2
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package BirdMessenger --version 3.0.2
NuGet\Install-Package BirdMessenger -Version 3.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BirdMessenger" Version="3.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BirdMessenger --version 3.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BirdMessenger, 3.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BirdMessenger as a Cake Addin #addin nuget:?package=BirdMessenger&version=3.0.2 // Install BirdMessenger as a Cake Tool #tool nuget:?package=BirdMessenger&version=3.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Getting Started
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,
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,
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);
}
- You can see more examples in unit tests
Document
Development
Development is done on the 'master' branch.
Who is using the library
Support and Sponsorship
<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 is compatible. net5.0-windows was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on BirdMessenger:
Package | Downloads |
---|---|
Hopex.ApplicationServer.Extensions.Package
Hopex Application Server Packager |
|
TheFusionWorks.Platforms
These are base utility classes developed by The Fusion Works which other packages and applications are built off. |
|
Codehard.FileService.Client
A client library for Codehard's File Service. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
3.1.3 | 4,356 | 5/21/2024 | |
3.1.2 | 25,281 | 10/7/2023 | |
3.1.1 | 2,116 | 8/14/2023 | |
3.1.0 | 14,630 | 11/27/2022 | |
3.0.2 | 838 | 11/8/2022 | |
3.0.1 | 404 | 11/8/2022 | |
3.0.0 | 877 | 10/17/2022 | |
3.0.0-beta1 | 197 | 8/14/2022 | |
2.2.1 | 65,389 | 6/11/2022 | |
2.2.0 | 4,195 | 3/6/2022 | |
2.1.0-bata | 269 | 10/17/2021 | |
2.0.1 | 293,646 | 3/2/2021 | |
2.0.0 | 325,487 | 10/23/2020 | |
1.0.1 | 516 | 7/26/2020 | |
1.0.0 | 662 | 8/25/2019 | |
1.0.0-beta1 | 464 | 8/2/2019 | |
0.1.6 | 535 | 11/18/2019 | |
0.1.5 | 677 | 11/17/2019 | |
0.1.4 | 773 | 11/27/2018 | |
0.1.3 | 746 | 11/3/2018 | |
0.1.2 | 740 | 10/24/2018 | |
0.1.1 | 744 | 10/19/2018 | |
0.1.0 | 807 | 10/14/2018 |