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

// Install Shard.DonwloadLibrary as a Cake Tool
#tool nuget:?package=Shard.DonwloadLibrary&version=


Shard HttpClient Library to handle Requests

The Shard DownloadLibrary is an on .Net 6.0 based wrapper around the HttpClient to manage your HttpRequests. But it can also be used without the HttpClient to handle CPU intensive tasks. All Requests will be handled by an PriorityQueue in a Parallel state to have a simple and efficient way to handle many (Tested with more than 500+) Http Requests.

  • Easy to use!
  • Efficient
  • ✨Contains file downloader! ✨


At the moment:

  • StatusRequest: Calls a Head request and returns a response message with the header information.
  • OwnRequest: Wrapper around your own requests. Easy to self-expand function of handling the downloads.
  • RequestContainer A container class to merge requests together and to start, pause and await them.
  • Request: Main abstract class that can be used to expand functionality on class-based level.
    • All subclasses have a retry function
    • A compleated and failed event
    • A priority funtcion
    • A second thread for bigger files to hold the app responsiv
    • Implementation for custom CancellationToken and a main CancellationTokenSource on Downloader to cancel all downloads
  • LoadRequest: To download the response content into files.
    • This is a Http file downloader with this functions:
    • Pause and Start a download
    • Resume a download
    • Gets the file name and extension from the server
    • Monitor the progress of the download with IProgress<float>
    • Can set path and filename
    • Download a specified range of a file
    • Download a file into chunks
    • Exclude extensions for savety (.exe; .bat.; etc...)

Expand and use as you like!


Is available on GitHub: Repository:


Installation over NuGet Packagemanager in Visual Studio or online. URL: Package Manager Console: PM> NuGet\Install-Package Shard.DonwloadLibrary -Version

How to use

Import the Library

using DownloaderLibrary.Requests;

Then create a new Request object like this LoadRequest This LoadRequest downloads a file into the downloads folder of the PC with an ".part" file and uses the name that the server provides.

//To download a file and store it in "Downloads" folder
new LoadRequest("[Your URL]"); // e.g.

To set options on the Request create a RequestOption or for a LoadRequest a LoadRequestOption

// Create an option for a LoadRequest
  LoadRequestOptions requestOptions = new()
            // Sets the filename of the download without the extension
            // The extension will be added automatically!
            FileName = "downloadfile", 
            // If this download has priority (default is false)
            PriorityLevel = PriorityLevel.High, 
            //(default is download folder)
            Path = "C:\\Users\\[Your Username]\\Desktop", 
            // If this Request contains a heavy request put it in second thread (default is false)
            IsDownload = true,
            //If the downloader sould Override, Create a new file or Append (default is Append)
            //Resume function only available with append!
            Mode = LoadMode.Create, 
            // Progress that writes the % to the Console
             Progress = new Progress<float>(f => Console.WriteLine((f).ToString("0.0%"))),
             //Chunk a file to download faster
             Chunks = 3

And use it in the Request

//To download a file and store it on the Desktop with a different name
new LoadRequest("",requestOptions);

To wait on the Request use await or WaitToFinish();

await new LoadRequest("",requestOptions).Task;
//new LoadRequest("",requestOptions).WaitToFinish();

Create an OwnRequest like this:

    //Create an object that passes a CancellationToken
   new OwnRequest((downloadToken) =>
            //Create your Request Massage. Here the body of
            HttpRequestMessage requestMessage = new(HttpMethod.Get, "");
            //Send your request and get the result. Pass the CancellationToken for handling it later over the Request object
            var response = DownloadHandler.Instance.SendAsync(requestMessage, downloadToken).Result;
            //If the resposne does not succeed
            if (!response.IsSuccessStatusCode)
                return false; // Return false to retry and call the failed method
            //If the response succeed. Do what you want and return to to finish the request
            return true;

To Create your own Request child. Here the implementation of the OwnRequest class:

    public class OwnRequest : Request
        private readonly Func<CancellationToken, Task<bool>> _own;
        //Parent sets the Url field but doesn't need it and doesn't require a RequestOption because it creates then a new one.
        //But to use the options it have to be passed over to the parent
        public OwnRequest(Func<CancellationToken, Task<bool>> own, RequestOptions? requestOptions = null) : base(string.Empty, requestOptions)
            _own = own;
            //Has to be called to inject it into the management process
        // Here will the Request be handled and a bool returned that indicates if it succeed
        protected override async Task<bool> RunRequestAsync()
            bool result = await _own.Invoke(Token);
            if (result)
                Options.FaultedAction?.Invoke(new HttpResponseMessage());
            return result;



Free Code and Free to Use

Have fun!
Product 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 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. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

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 734 1/25/2023
1.0.4 841 12/27/2022 686 10/24/2022 635 10/21/2022 674 10/20/2022 677 10/17/2022 719 10/10/2022
1.0.2 670 9/30/2022

Includes delay for Request deploying