title: download.file corrupts .mp3 file in R
body: <p>I'm trying to download a long list of podcasts, but when I use the download.file command in R it corrupts the audio file into a bunch of crackling noises.</p>
  <p>Could any of you recommend a dedicated audio-downloading package, or recommend a download.file method that would be better suited for download audio. I went through the ones listed in the help file, but none worked. (&quot;auto&quot;, &quot;internal&quot;, &quot;wininet&quot;, &quot;libcurl&quot;, &quot;wget&quot; and &quot;curl&quot;)</p>
  <p>The downloading portion of the code looks similar to this:</p>
  <pre><code>url &lt;- &quot;http://play.podtrac.com/npr-510289/npr.mc.tritondigital.com/NPR_510289/media/anon.npr-mp3/npr/pmoney/2016/06/20160603_pmoney_podcast.mp3?
  orgId=1&amp;amp;d=1121&amp;amp;p=510289&amp;amp;story=480606726&amp;amp;t=podcast&amp;amp;e=480606726&amp;amp;siteplayer=true&amp;amp;dl=1&quot;
  
  download.file(url = url, destfile = &quot;test.mp3&quot;)
  </code></pre>
  <p>I attempted different audio files from different sites and had similar results.</p>
  <p>Edit: In response to the question by VC.One, this a <a href="https://hexed.it#base64+lzjb:%202018-03-31%20StackOverflow%20Planet%20Money%20Question;IP/7kEAAcAFJbgRmbwAjBwAArToAARotGwACBQcADQoMDxEUFxkAHB4hIyYoKy4AMDM1ODo9QEIARUdKTE9RVFcAWVxeYWNmaGsAbnBzdXh6fYAAgoWHioyPkZQAl5mcnqGjpqgAq66ws7W4ur0AwMLFx8rMz9EA1NfZ3N7h4+YA6Ovu8PP1+Pq+/QBx/AP8QvxC9EL/FaIAS4AAAAgAAAkAcAAAAQD8CR4AhKQAIB+BI9AAlIAELAACQCYACYuwWAAEgEwAExdgftmtt1sAbbGQyw2SATEAEuOa7c39JSAAHtnwhB5PYsQAphYgs+lWmmQANwztd5XZmCIAM1tjwVkyZ60Ae308EW5a" rel="nofollow noreferrer">url</a> to the initial section of the Hex code. I added in more than the couple of lines he requested because the first section looked like file information which may or may not be relevant:</p>