title: Incomplete file download from FileTransfer in Cordova
body: <p>I am attempting to create an app using Phonegap Build while making use of several plugins in order to download an online file to the device's SD card. Making use of the following links:</p>
  
  <p>i) <a href="https://www.tutorialspoint.com/cordova/cordova_file_transfer.htm" rel="nofollow noreferrer">https://www.tutorialspoint.com/cordova/cordova_file_transfer.htm</a>
  ii)<a href="https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file-transfer/index.html#download" rel="nofollow noreferrer">https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file-transfer/index.html#download</a></p>
  
  <p>I was able to get get this code to work:</p>
  
  <pre><code>function downloadFile() {
  
  
   var fileTransfer = new FileTransfer();
    fileTransfer.download(
  "http://developer.android.com/assets/images/home/ics-android.png",
  "file:///storage/sdcard0/aw2uin.png",
  function(entry) {
      alert("download complete: 1" + entry.toURL);
  },
  function(error) {
      alert("download error source " + error.source);
      alert("download error target " + error.target);
      alert("upload error code" + error.code);
  });
  </code></pre>
  
  <p>}</p>
  
  <p><strong>HOWEVER</strong> the problem is that although getting a successCallBack, the file is only <strong>partially downloaded</strong>. Eg.ics-android.png : this has a file size of 14.7kB, yet the result has a size of 0B. Another example of a 125kB file results in the download of an 104.55kB.
  My config.xml has the following permissions:</p>
  
  <pre><code>&lt;plugin name="cordova-plugin-file" spec="~4.3.1" /&gt;
  &lt;plugin name="cordova-plugin-file-transfer" spec="~1.6.1" /&gt;
  &lt;plugin name="cordova-plugin-network-information" spec="~1.3.1" /&gt;
  &lt;plugin name="cordova-plugin-whitelist" version="1.3.1" /&gt;
  &lt;access origin="*" /&gt;&lt;!--subdomains="true" /&gt; --&gt;
  &lt;preference name="AndroidExtraFilesystems" value="files,files-external,documents,sdcard,cache,cache-external,assets,root" /&gt;
  &lt;preference name="android-minSdkVersion" value="7" /&gt;
  &lt;preference name="android-installLocation" value="preferExternal" /&gt;
  &lt;allow-intent href="http://*/*" /&gt;
  &lt;allow-intent href="https://*/*" /&gt;
  &lt;allow-navigation href="*" /&gt;  
  </code></pre>
  
  <p>I've tried searching for an answer but so far it doesn't seem that much others have encountered this error. Where have I gone wrong?/What have I done incorrectly?</p>