BirdMessenger 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package BirdMessenger --version 2.2.0                
NuGet\Install-Package BirdMessenger -Version 2.2.0                
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="2.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BirdMessenger --version 2.2.0                
#r "nuget: BirdMessenger, 2.2.0"                
#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=2.2.0

// Install BirdMessenger as a Cake Tool
#tool nuget:?package=BirdMessenger&version=2.2.0                

Documentation

Getting started

// file to be uploaded
FileInfo fileInfo = new FileInfo("test.txt");

// remote tus service
var hostUri = new Uri(@"http://localhost:5000/files");

// build a standalone tus client instance
var tusClient = TusBuild.DefaultTusClientBuild(hostUri).Build();

//hook up events
tusClient.UploadProgress += printUploadProcess;
tusClient.UploadFinish += uploadFinish;

//define additional file metadata 
MetadataCollection metadata = new MetadataCollection();
metadata["filename"] = fileInfo.FullName;

//create upload url
var fileUrl = await tusClient.Create(fileInfo, metadata);

 var uploadOpt = new TusRequestOption()
 {
     UploadWithStreaming = true //enable streaming Upload
 };
 //upload file
var uploadResult = await tusClient.Upload(fileUrl, fileInfo, null,uploadOpt);

Subscribe upload events

Delegate prototype

/// <summary>
/// tus client delegate
/// </summary>
delegate void TusUploadDelegate(ITusClient source, ITusUploadContext tusUploadContext);

ITusClient events

/// <summary>
/// upload completition event
/// </summary>
event TusUploadDelegate UploadFinish;

/// <summary>
/// upload progress event
/// </summary>
event TusUploadDelegate UploadProgress;
  • UploadFinish: It is invoked when the file has been uploaded
  • UploadProgress: This method is used to notify the progress of the upload

ITusUploadContext specification

The field definition for ITusUploadContext is as follows:

  • public long TotalSize { get; } : Total size of upload File
  • public long UploadedSize { get; set; } : Total uploaded size
  • public FileInfo UploadFileInfo { get; } : Upload file info
  • public Uri UploadFileUrl { get;} : URl of upload file

TusRequestOption specification

Note:Need client version to 2.2.0

  • HttpHeader : Send Http request with a custom request header
  • UploadWithStreaming : Gets or sets a value that indicates whether upload file with streaming,upload file with streaming is efficient, default value is false

Building an ITusClient instance

Build standalone ITusClient by TusBuild.DefaultTusClientBuild

// returns an isolated instance of ITusClient
var tusClient = TusBuild.DefaultTusClientBuild(tusHost).Build(); 

Build ITusClient using Dependency Injection

Non-specific ITusClient configuration
public static void ConfigureServices(IServiceCollection services)
{
    services.AddTusClient(tusHost);
}
public class Example
{
    public Example(ITusClient tusClient) 
    {
        ...
    }
}
Specific ITusClient configuration based on targeted service
public static void ConfigureServices(IServiceCollection services)
{
    services.AddTusClient<Example>(tusHost);
}
public class Example
{
    public Example(ITusClient<Example> tusClient) 
    {
        ...
    }
}
  • tusHost is tus server Url
  • by default, every HTTP request is sent with a "Tus-Resumable: 1.0.0" header (except for Options requests)

ITusClient configuration

  • All three configuration methods can be called with either an URI or a configuration action

Basic configuration

Action<TusClientOptions> configure = (options) => {
    options.TusHost = tusHost;
    options.GetChunkUploadSize = (src, ctx) => 1 * 1024 * 1024; // 1 mega byte per upload request
    options.FileNameMetadataName = "fileName"; // default creation metadata
};
TusDefaultBuilder tusClientBuilder = TusBuild.DefaultTusClientBuild(configure);

OR

TusHttpClientBuilder tusClientBuilder = services.AddTusClient(configure);

OR

TusHttpClientBuilder tusClientBuilder = services.AddTusClient<Example>(configure);

HttpClient configuration

var tusClientBuilder = TusBuild.DefaultTusClientBuild(configure);
// OR
// var tusClientBuilder = TusBuild.DefaultTusClientBuild(tusHost);

tusClientBuilder.Configure((TusClientOptions options, IHttpClientBuilder httpClientBuilder) => {
    //configure either options or httpClientBuilder
    //etc
    httpClientBuilder.ConfigureHttpClient(httpClient =>
                    {
                        httpClient.DefaultRequestHeaders.Authorization =
                            new AuthenticationHeaderValue("Bearer", "ACCESS_TOKEN");
                    });
});
  • TusHttpClientBuilder has 3 main methods:
public TusHttpClientBuilder Configure(Action<TusClientOptions, IHttpClientBuilder> builder);
public TusHttpClientBuilder ConfigureCore(Action<TusClientOptions, IHttpClientBuilder> builder);
public TusHttpClientBuilder ConfigureExtension(Action<TusClientOptions, IHttpClientBuilder> builder);
  • TusDefaultBuilder inherits TusHttpClientBuilder
  • Configure will call both ConfigureCore and ConfigureExtension to configure the HttpClient used by either the Core of tus or the Extension of tus
  • tus uses two different HttpClient for core and extensions, you may configure each as you need

Polly Integration

HttpClientFactory With Polly

Product 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.

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,352 5/21/2024
3.1.2 25,280 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.1 is deprecated.
3.0.0 877 10/17/2022 3.0.0 is deprecated.
3.0.0-beta1 197 8/14/2022 3.0.0-beta1 is deprecated.
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.5 is deprecated.
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