<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic axios downloaded an mp3 file from dropbox api is empty, 0 bytes in react native in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/axios-downloaded-an-mp3-file-from-dropbox-api-is-empty-0-bytes/m-p/337355#M19632</link>
    <description>&lt;P&gt;getmedia(medianame) {&lt;BR /&gt;console.log(medianame);&lt;BR /&gt;path1 = RNFS.DocumentDirectoryPath + '/' + medianame;&lt;BR /&gt;console.log(path1);&lt;BR /&gt;axios({&lt;BR /&gt;&lt;BR /&gt;method: 'POST',&lt;BR /&gt;url: '&lt;A href="https://content.dropboxapi.com/2/files/download" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/download&lt;/A&gt;',&lt;BR /&gt;headers: {&lt;BR /&gt;Authorization: 'Bearer JxxxxxxxxxxC7JnnYdLgKrxxyxyxyxyxyyxyxyxeeee',&lt;BR /&gt;'Dropbox-API-Arg': '{ "path": "/Apps/Myapp/+ medianame" }',&lt;BR /&gt;'Content-Type': 'text/plain',&lt;BR /&gt;Host: 'content.dropboxapi.com'&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;})&lt;BR /&gt;.then((response) =&amp;gt; {&lt;BR /&gt;console.log(response);&lt;BR /&gt;RNFS.writeFile(path1, response, 'utf8')&lt;BR /&gt;.then((success) =&amp;gt; {&lt;BR /&gt;console.log('FILE WRITTEN!');&lt;BR /&gt;})&lt;BR /&gt;.catch((err) =&amp;gt; {&lt;BR /&gt;console.log(err.message);&lt;BR /&gt;});&lt;BR /&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;I am using axios with post method to download an mp3 file from dropbox and ı write the response to the app folder but in app folder file seems to have 0 bytes, empty. What might be the problem?&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:07:05 GMT</pubDate>
    <dc:creator>Mert</dc:creator>
    <dc:date>2019-05-29T09:07:05Z</dc:date>
    <item>
      <title>axios downloaded an mp3 file from dropbox api is empty, 0 bytes in react native</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/axios-downloaded-an-mp3-file-from-dropbox-api-is-empty-0-bytes/m-p/337355#M19632</link>
      <description>&lt;P&gt;getmedia(medianame) {&lt;BR /&gt;console.log(medianame);&lt;BR /&gt;path1 = RNFS.DocumentDirectoryPath + '/' + medianame;&lt;BR /&gt;console.log(path1);&lt;BR /&gt;axios({&lt;BR /&gt;&lt;BR /&gt;method: 'POST',&lt;BR /&gt;url: '&lt;A href="https://content.dropboxapi.com/2/files/download" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/download&lt;/A&gt;',&lt;BR /&gt;headers: {&lt;BR /&gt;Authorization: 'Bearer JxxxxxxxxxxC7JnnYdLgKrxxyxyxyxyxyyxyxyxeeee',&lt;BR /&gt;'Dropbox-API-Arg': '{ "path": "/Apps/Myapp/+ medianame" }',&lt;BR /&gt;'Content-Type': 'text/plain',&lt;BR /&gt;Host: 'content.dropboxapi.com'&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;})&lt;BR /&gt;.then((response) =&amp;gt; {&lt;BR /&gt;console.log(response);&lt;BR /&gt;RNFS.writeFile(path1, response, 'utf8')&lt;BR /&gt;.then((success) =&amp;gt; {&lt;BR /&gt;console.log('FILE WRITTEN!');&lt;BR /&gt;})&lt;BR /&gt;.catch((err) =&amp;gt; {&lt;BR /&gt;console.log(err.message);&lt;BR /&gt;});&lt;BR /&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;I am using axios with post method to download an mp3 file from dropbox and ı write the response to the app folder but in app folder file seems to have 0 bytes, empty. What might be the problem?&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:07:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/axios-downloaded-an-mp3-file-from-dropbox-api-is-empty-0-bytes/m-p/337355#M19632</guid>
      <dc:creator>Mert</dc:creator>
      <dc:date>2019-05-29T09:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: axios downloaded an mp3 file from dropbox api is empty, 0 bytes in react native</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/axios-downloaded-an-mp3-file-from-dropbox-api-is-empty-0-bytes/m-p/337460#M19645</link>
      <description>&lt;P&gt;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download" target="_self"&gt;The /2/files/download endpoint&lt;/A&gt; is the right endpoint for downloading file data. If the call is successful, the response body will be the file data. There are a number of ways for the call to fail though, e.g., if the path you provide is incorrect.&lt;/P&gt;
&lt;P&gt;It looks like you're not catching any potential errors on the /2/files/download call. You should add a catch to&amp;nbsp;Dropbox API call itself (similar to the one you have for the local file writing operation). That way, you can detect when the call fails.&lt;/P&gt;
&lt;P&gt;For instance, looking at your code, it looks like you may be supplying the wrong path value. When using an app with the "app folder" permission, you shouldn't explicitly include the "/Apps/Myapp" portion in your file paths. That part is automatically assumed for you. So, if you're trying to access a file at "/Apps/Myapp/file.ext" with the app for that app folder, you should just supply "/file.ext".&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 14:30:03 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/axios-downloaded-an-mp3-file-from-dropbox-api-is-empty-0-bytes/m-p/337460#M19645</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-04-04T14:30:03Z</dc:date>
    </item>
  </channel>
</rss>

