我正在製作一個YouTube Downloader,它可以獲得所有可用尺寸的大小,但通常需要很長時間,有時它就像閃電一樣!獲取在線文件大小的最快方式是什麼[http]
我寫了這個函數,它非常好[只是有時候像我之前說的]!
Uri url = new Uri("http://example.com/document.docx");
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
response.Close();
// iSize will handle the size of the file in bytes
Int64 iSize = response.ContentLength;
。
那麼,有沒有更快的方法來做到這一點? (請記住,要測量的文件超過八個文件)。
。
提前,非常感謝你;
您的問題已被[問及答案](http://stackoverflow.com/questions/122853/get-http-file-size)。 – nvoigt 2013-03-01 14:02:59
@nvoigt解決方案中的該功能非常慢! – 2013-03-01 14:43:39