Hello.
I need to know size of file from a given url.
In fact I want to get url of a file(anywhere on the internet) and then get size of it.
I tried with this code but I takes long time to get size of large files, is there any better way?
publicasyncTask<IActionResult>Test() | |
{ | |
longfileSize = 0; | |
varclient = new HttpClient(); | |
varresponse = await client.GetAsync("http://dl5.downloadha.com/hosein/NarmAfzaar/December2017/Notepad.Plus.Plus.v7.5.2.Installer.x86_www.Downloadha.com_.zip"); | |
fileSize = response.Content.ReadAsStreamAsync().Result.Length; | |
return Content(fileSize.ToString()); | |
} |