Downloader
Downloader copied to clipboard
DownloadStatus is Failed but no exception is thrown
Steps to reproduce:
- Create a configuration and a client:
DownloadConfiguration configuration = new DownloadConfiguration() { MaxTryAgainOnFailover = int.MaxValue, Timeout = int.MaxValue, MaximumBytesPerSecond = (Variables.limiter * 1024 * 1024) / 8, ParallelDownload = true, ChunkCount = 1, MaximumMemoryBufferBytes = 1024 * 1024 * 1024 / Variables.threadLimiter, ReserveStorageSpaceBeforeStartingDownload = true, }; var client = new DownloadService(configuration); try { await client.DownloadFileTaskAsync(item.From.ToString(), new DirectoryInfo(Path.GetDirectoryName(path)!), ct); } catch (Exception e) { ... }
- Download a file from this URL. Scheme does not matters, link works for http and https both (we prefer http).
- After some amount of time (around 5 secs), function returns with no output and
client.Status == DownloadStatus.Failed
.
I also have the same issue.
same issue! this is my code my file is create but nothing download, iam using 3.0.6 version!
public async void dlimage(string videoname, string imageuri)
{
var folder = await KnownFolders.VideosLibrary.CreateFolderAsync("testfolder", CreationCollisionOption.OpenIfExists);
var editShode = Regex.Replace(videoname, "[\\/:*?\"<>|]", string.Empty);
var file = await folder.CreateFileAsync(editShode, CreationCollisionOption.GenerateUniqueName);
var downloadOpt = new DownloadConfiguration()
{
ChunkCount = 2, // file parts to download, default value is 1
ParallelDownload = true // download parts of file as parallel or not. Default value is false
};
var downloader = new DownloadService(downloadOpt);
Stream destinationStream = await downloader.DownloadFileTaskAsync(imageuri);
if (destinationStream != null)
{
var bytesstream = await GetBytes(destinationStream);
await FileIO.WriteBytesAsync(file, bytesstream);
new ShowNotif(file, videoname, imageuri);
}
}