Is System.Net.WebClient.DownloadFile() reading the downloaded file in chunks, or is it reading the whole file to memory, to dump it to disk in the end?
Does anybody know? From my tests it seems that the file is created with 0 bytes rightaway and then explodes to full size once the download has finished. But somehow this is so hard to believe because it would mean that 2GB of RAM are occupied when downloading a 2GB file…that would be pointless.
Is System.Net.WebClient.DownloadFile() reading the downloaded file in chunks, or is it reading the whole
Share
It writes whatever is received directly to a FileStream. DownloadBitsState.RetrieveBytes() method, WriteStream.Write() call if you want to take a look with Reflector or the Reference Source. The size property doesn’t get updated in Explorer until the file is closed.