v5.9.0 — Resolve file name & size without downloading
Downloader v5.9.0
✨ Resolve a remote file's name and size — without downloading it
This release exposes the engine's internal "what is this remote file?" logic as a clean public API, so you can preview a file's name and size (and whether it supports ranged/resumable downloads) from a single lightweight header probe — no need to start and immediately stop a real download just to learn its name. Perfect for populating a queue/grid of pending downloads.
// Just the name (resilient — falls back to the URL name on a network/server error):
string name = await RemoteFileResolver.GetFileNameAsync(url);
// Full metadata in one probe:
RemoteFileInfo info = await RemoteFileResolver.GetFileInfoAsync(url);
// info.FileName, info.FileSize (-1 if unknown), info.SupportsRange, info.Address (final, post-redirect)Both methods accept an optional DownloadConfiguration (headers, proxy, credentials, cookies, redirect policy) and a CancellationToken.
🆕 What's new
RemoteFileResolver(new public static helper) —GetFileNameAsync(url)andGetFileInfoAsync(url)returning the newRemoteFileInforecord{ FileName, FileSize, SupportsRange, Address }. Name resolution:Content-Disposition→ URL path → GUID. Size:Content-Range→Content-Length.IDownloadService.GetFileInfoAsync(url)— the same lookup on the download service, using that service's configuration, without disturbing any download in progress.
🔧 Internal
- Filename/size/range resolution is now unified behind the canonical
SocketClient.GetFileInfoAsync, consumed by both the download pipeline (DownloadService) andRemoteFileResolver— removing duplicated probing logic. - No behavior change to existing downloads (verified against the full test suite: 165 regression tests + new resolver tests, green on .NET 8/9/10).
📦 Install
dotnet add package Downloader --version 5.9.0
Full Changelog: v5.8.1...v5.9.0