Downloader 1.9.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package Downloader --version 1.9.8
                    
NuGet\Install-Package Downloader -Version 1.9.8
                    
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="Downloader" Version="1.9.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Downloader" Version="1.9.8" />
                    
Directory.Packages.props
<PackageReference Include="Downloader" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Downloader --version 1.9.8
                    
#r "nuget: Downloader, 1.9.8"
                    
#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.
#addin nuget:?package=Downloader&version=1.9.8
                    
Install Downloader as a Cake Addin
#tool nuget:?package=Downloader&version=1.9.8
                    
Install Downloader as a Cake Tool

Downloader Build and Test Build Status NuGet NuGet CodeFactor

Downloader

🚀 Fast and reliable multipart downloader with .Net Core 3.1+ supporting 🚀

Downloader is a modern, fluent, asynchronous, testable and portable library for .NET. This is a multipart downloader with asynchronous progress events. This library written in .Net Standard 2 and you can add that in your .Net Core or .Net Framework projects.

Sample Console Application

sample-project

How to use

Get it on NuGet:

PM> Install-Package Downloader

Or via the .NET Core command line interface:

dotnet add package Downloader

Create your custom configuration:

var downloadOpt = new DownloadConfiguration()
{
    AllowedHeadRequest = false, // Can fetch file size by HEAD request or must be used GET method to support host
    MaxTryAgainOnFailover = int.MaxValue, // the maximum number of times to fail.
    ParallelDownload = true, // download parts of file as parallel or notm default value is false
    ChunkCount = 8, // file parts to download, default value is 1
    Timeout = 1000, // timeout (millisecond) per stream block reader, default values is 1000
    OnTheFlyDownload = false, // caching in-memory or not? default values is true
    BufferBlockSize = 10240, // usually, hosts support max to 8000 bytes, default values is 8000
    MaximumBytesPerSecond = 1024 * 1024, // download speed limited to 1MB/s, default values is zero or unlimited
    TempDirectory = "C:\\temp", // Set the temp path for buffering chunk files, the default path is Path.GetTempPath().
    RequestConfiguration = // config and customize request headers
    {
        Accept = "*/*",
        UserAgent = $"DownloaderSample/{Assembly.GetExecutingAssembly().GetName().Version.ToString(3)}",
        ProtocolVersion = HttpVersion.Version11,
        AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
        KeepAlive = false,
        UseDefaultCredentials = false
    }
};

So, declare download service instance per download and pass config:

var downloader = new DownloadService(downloadOpt);

Then handle download progress and completed events:

downloader.DownloadProgressChanged += OnDownloadProgressChanged;
downloader.ChunkDownloadProgressChanged += OnChunkDownloadProgressChanged;
downloader.DownloadFileCompleted += OnDownloadFileCompleted;    

The ‍DownloadService class has a property called Package that stores each step of the download. You must call the CancelAsync method to stop or pause the download, and if you continue again, you must call the same DownloadFileAsync function with the Package parameter to continue your download! For example:

Start the download asynchronously and keep package file:

var file = @"Your_Path\fileName.zip";
var url = @"https://file-examples.com/fileName.zip";
// To resume from last download, keep downloader.Package object
var pack = downloader.Package; 
await downloader.DownloadFileAsync(url, file);

Stop or Pause Download:

downloader.CancelAsync(); 

Resume Download:

await downloader.DownloadFileAsync(pack); 

So that you can even save your large downloads with a very small amount in the Package and after restarting the program, restore it again and start continuing your download. In fact, the packages are your instant download snapshots. If your download config has OnTheFlyDownload, the downloaded bytes ​​will be stored in the package itself, but otherwise, only the address of the downloaded files will be included and you can resume it whenever you like. For more detail see StopResumeOnTheFlyDownloadTest method

Note: for complete sample see Downloader.Sample project from this repository.

Features at a glance

  • Download files async and non-blocking.
  • Cross-platform library to download any files with any size.
  • Get real-time progress info of each block.
  • Download file multipart as parallel.
  • Handle any client-side or server-side exception none-stopping the downloads.
  • Config your ChunkCount to define the parts count of the download file.
  • Download file multipart as in-memory or in-temp files cache mode.
  • Store download package object to resume the download when you want.
  • Get download speed or progress percentage in each progress event.
  • Get download progress events per chunk downloads
  • Stop and Resume your downloads with package object
  • Set a speed limit on downloads
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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.

NuGet packages (11)

Showing the top 5 NuGet packages that depend on Downloader:

Package Downloads
Wabbajack.Networking.Http

Package Description

SquareMinecraftLauncher.Core

BaiBaoStudio

EasyUpdate

Easy Update 提供简单的自动更新服务。

Orobouros

A fully-featured and modular online scraper tool. Yes we know the name is spelled wrong. Icon Credit: Hyliian @ DeviantArt

Dove.Avalonia.Extensions.WebView

WebView Extensions for Avalonia.

GitHub repositories (20)

Showing the top 20 popular GitHub repositories that depend on Downloader:

Repository Stars
2dust/v2rayN
A GUI client for Windows, Linux and macOS, support Xray and sing-box and others
yaobiao131/downkyicore
哔哩下载姬(跨平台版)downkyi,哔哩哔哩网站视频下载工具,支持批量下载,支持8K、HDR、杜比视界,提供工具箱(音视频提取、去水印等)。
goatcorp/FFXIVQuickLauncher
Custom launcher for FFXIV
Paving-Base/APK-Installer
An Android Application Installer for Windows
CHKZL/DDTV
可对阿B进行直播多窗口观看、开播提醒、自动录制、合并、转码的跨平台工具
rogerfar/rdt-client
Real-Debrid Client Proxy
ClassIsland/ClassIsland
一款适用于班级多媒体屏幕的课表信息显示工具,可以一目了然地显示各种信息。
jxlpzqc/TMSpeech
腾讯会议摸鱼工具
wabbajack-tools/wabbajack
An automated Modlist installer for various games.
Taiizor/Sucrose
Sucrose is a versatile wallpaper engine that brings life to your desktop with a wide range of interactive wallpapers.
chickensoft-games/GodotEnv
Manage Godot versions and addons from the command line on Windows, macOS, and Linux.
HandyOrg/HandyWinGet
GUI for installing apps through WinGet and Creating Yaml file
K12f/BlueCatKoKo
蓝猫KoKo下载器(BlueCatKoKo)是一个免登录,简单易用的桌面端抖音,快手视频下载工具,具有简洁的界面,流畅的操作逻辑。可以下载几乎所有的视频,并输出mp4格式的文件。
YuukiPS/Launcher-PC
LocalizeLimbusCompany/LLC_MOD_Toolbox
模组安装程序
Team-Resurgent/Repackinator
baibao132/SquareMinecraftLauncherCore
R2NorthstarTools/VTOL
A Manager and Installer For the Titanfall 2 +Northstar launcher.
aiguoli/SimpleList
Manage your onedrive files on WinUI3 powered app
YUXUAN888/FSM3
FSMLauncher!
Version Downloads Last updated
3.3.4 14,864 3/10/2025
3.3.3 27,762 1/13/2025
3.3.2 192 1/13/2025
3.3.1 16,259 11/28/2024
3.3.0 1,556 11/20/2024
3.2.1 8,720 10/4/2024
3.2.0 1,972 9/22/2024
3.1.2 37,721 6/30/2024
3.1.0-beta 770 1/2/2024
3.0.6 112,501 6/6/2023
3.0.5 410 6/3/2023
3.0.4 77,026 3/11/2023
3.0.3 4,770 1/29/2023
3.0.2 1,190 1/7/2023
3.0.1 5,426 11/2/2022
3.0.0-beta 208 10/12/2022
2.4.1 12,331 9/21/2022
2.4.0 1,195 9/16/2022
2.3.9 538 9/14/2022
2.3.8 907 9/5/2022
2.3.7 1,864 8/23/2022
2.3.6 663 8/20/2022
2.3.5 79,663 5/6/2022
2.3.4 1,237 5/3/2022
2.3.3 5,508 2/23/2022
2.3.2 1,519 1/24/2022
2.3.1 672 1/2/2022
2.3.0 5,408 11/15/2021
2.2.9 10,906 8/12/2021
2.2.8 42,215 4/1/2021
2.2.7 742 3/31/2021
2.2.6 3,814 3/26/2021
2.2.5 1,057 3/24/2021
2.2.4 710 3/19/2021
2.2.3 2,904 3/1/2021
2.2.2 842 2/24/2021
2.2.1 425 2/23/2021
2.2.0 460 2/22/2021
2.1.4 439 2/21/2021
2.1.3 408 2/19/2021
2.1.2 585 2/14/2021
2.1.1 440 2/14/2021
2.1.0 469 2/10/2021
2.0.9 499 2/4/2021
2.0.8 545 2/3/2021
2.0.7 646 1/24/2021
2.0.6 474 1/13/2021
2.0.5 523 1/10/2021
2.0.4 682 1/5/2021
2.0.3 476 1/2/2021
2.0.1 634 12/19/2020
2.0.0 667 12/6/2020
1.9.9 746 12/1/2020
1.9.8 474 12/1/2020
1.9.7 574 11/12/2020
1.9.6 515 11/11/2020
1.9.5 613 11/11/2020 1.9.5 is deprecated because it is no longer maintained and has critical bugs.
1.9.4 595 10/24/2020
1.9.3 516 10/19/2020
1.9.2 499 10/12/2020
1.9.1 552 9/28/2020
1.9.0 585 9/27/2020
1.8.0 886 7/31/2020
1.7.0 799 7/17/2020
1.6.0 567 7/14/2020
1.5.0 561 7/6/2020
1.4.0 642 7/4/2020
1.3.0 991 6/21/2020
1.2.1 636 6/21/2020
1.2.0 609 6/16/2020
1.1.0 598 5/29/2020
1.0.9 620 5/16/2020
1.0.8 567 5/11/2020
1.0.7 608 5/3/2020
1.0.6 563 4/22/2020
1.0.5 557 4/21/2020
1.0.4 592 4/16/2020
1.0.3 693 3/28/2020
1.0.2 588 3/28/2020
1.0.1 1,217 3/28/2020

Added download by Url filename into a folder