title: Get file/AssetBundle size from http request before downloading file
body: <p>Question: </p>
  
  <p>I want to get the size of assetBundle before finishing download the file. And I can show the remaining time to user. In Unity2018.2 , can we get the <strong>file size</strong> or <strong>downloaded file size</strong> that let me multiply by <strong>progress</strong>? Or there is other ways to calculate the <strong>remaining time</strong>?</p>
  
  <p>I know <strong>WWW.responseHeaders</strong> contain the information, but it seems need to finish downloading.</p>
  
  <p>Here is my code currently. </p>
  
  <pre><code>    using (WWW downloadPackageWWW = new WWW(pkg.url))
      {
          while (!downloadPackageWWW.isDone)
          {
              print("progress: " + downloadPackageWWW.progress * 100 + "%");    
              yield return null;
          }
  
          if (downloadPackageWWW.error != null)
              print("WWW download had an error:" + downloadPackageWWW.error);
          if (downloadPackageWWW.responseHeaders.Count &gt; 0) 
              print(pkg.fileName + ": " + downloadPackageWWW.responseHeaders["Content-Length"]+" byte");
  
          byte[] bytes = downloadPackageWWW.bytes;
          File.WriteAllBytes(pkgPath, bytes);
  
      }
  </code></pre>
  
  <p>--</p>
  
  <p><strong>Update:</strong></p>
  
  <p>To get the remaining time, I come up a ideal that calculate by <strong>Time.deltaTime</strong>, and we don't need to know the total file size and download speed. </p>
  
  <pre><code>float lastProgress = 0;
  while (!www.isDone)
  {  
       float deltaProgress = www.progress - lastProgress;
       float progressPerSec = deltaProgress / Time.deltaTime;
       float remaingTime = (1 - www.progress) / progressPerSec;
       print("Remaining: " + remaingTime + " sec"); 
       lastProgress = www.progress;
       yield return null;
  }
  </code></pre>