Could you create a class or function for multi-threaded downloading? Similar to the code below.
This is very time-saving when downloading large files.
Or how to implement similar functionality simply in LA?
Thanks in advance!
C# class reference code link:
nuget -\Masuit.Tools.Core;
https://github.com/ldqk/Masuit.Tools/blo...nloader.cs
This is very time-saving when downloading large files.
Or how to implement similar functionality simply in LA?
Thanks in advance!
C# class reference code link:
nuget -\Masuit.Tools.Core;
https://github.com/ldqk/Masuit.Tools/blo...nloader.cs
using Masuit.Tools.Net;
var mtd = new MultiThreadDownloader("http://storage.live.com/items/A93A8C276E440EC0!590:/wps2019.exe?authkey=!AJCW6xXpJYK9QjE", Environment.GetEnvironmentVariable("temp"), @"C:\wps.exe", 8);
mtd.Configure(req =>
{
req.Referer = "https://masuit.com";
req.Headers.Add("Origin", "https://baidu.com");
});
mtd.TotalProgressChanged += (sender, e) =>
{
var downloader = sender as MultiThreadDownloader;
Console.WriteLine("Download progress: " + downloader.TotalProgress + "%");
Console.WriteLine("Download speed: " + downloader.TotalSpeedInBytes / 1024 / 1024 + " MBps");
};
mtd.FileMergeProgressChanged += (sender, e) =>
{
Console.WriteLine("Download complete");
};
mtd.FileMergedComplete += (sender, e) =>
{
Console.WriteLine("File merge complete");
};
mtd.Start(); // Start download
//mtd.Pause(); // Pause download
//mtd.Resume(); // Resume download