Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multi-threaded downloading
#1
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
 
Code:
Copy      Help
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


Messages In This Thread
multi-threaded downloading - by Davider - 08-29-2024, 09:37 AM
RE: multi-threaded downloading - by Gintaras - 08-29-2024, 11:14 AM
RE: multi-threaded downloading - by Davider - 08-29-2024, 12:43 PM
RE: multi-threaded downloading - by Gintaras - 08-29-2024, 01:24 PM
RE: multi-threaded downloading - by Davider - 08-29-2024, 02:11 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)