<?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 Re: Dropbox API - Downloading windows exe file in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Downloading-windows-exe-file/m-p/166751#M6032</link>
    <description>&lt;P&gt;Does&amp;nbsp;filecontainer have the length of data you expect? Can you share the rest of the relevant code?&lt;/P&gt;</description>
    <pubDate>Sat, 30 Jan 2016 02:00:33 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2016-01-30T02:00:33Z</dc:date>
    <item>
      <title>Dropbox API - Downloading windows exe file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Downloading-windows-exe-file/m-p/166750#M6031</link>
      <description>&lt;P&gt;Well, I'm using .net version of Dropbox V2 API with Visual Basic 2015, and I'm trying with it to download an .exe file from my dropbox. So, I do this:&lt;/P&gt;
&lt;P&gt;Dim response = Await dbx.files.BeginDownload(path + "/" + file)&lt;BR /&gt;filecontainer = Await response.GetContentAsStreamAsync()&lt;/P&gt;
&lt;P&gt;Filecontainer is a string. After that, I try to write that string into a created .exe file, and then, that exe file is larger than original. I was thinking it was due to encoding, but it still doesn't work. So, test .exe file is about 940 kB, but a "copy" that's downloaded from dropbox is about 1.7 MB.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am I doing something wrong or?&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:36:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Downloading-windows-exe-file/m-p/166750#M6031</guid>
      <dc:creator>Anton U.</dc:creator>
      <dc:date>2019-05-29T09:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API - Downloading windows exe file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Downloading-windows-exe-file/m-p/166751#M6032</link>
      <description>&lt;P&gt;Does&amp;nbsp;filecontainer have the length of data you expect? Can you share the rest of the relevant code?&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2016 02:00:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Downloading-windows-exe-file/m-p/166751#M6032</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-01-30T02:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API - Downloading windows exe file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Downloading-windows-exe-file/m-p/166752#M6033</link>
      <description>&lt;PRE&gt;filecontainer = Await response.GetContentAsStreamAsync()&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Filecontainer is a string."&lt;/P&gt;
&lt;P&gt;This doesn't make sense. GetContentAsStreamAsync doesn't return a String. It returns a Stream.&lt;/P&gt;
&lt;P&gt;You probably want code like this:&lt;/P&gt;
&lt;PRE&gt;Dim response = Await dbx.files.BeginDownload(path + "/" + file)&lt;BR /&gt;Dim responseStream = Await response.GetContentAsStreamAsync()&lt;BR /&gt;&lt;BR /&gt;Using localFileStream As File.Create("myfile.exe")&lt;BR /&gt;    responseStream.CopyTo(localFileStream)&lt;BR /&gt;End Using&lt;/PRE&gt;</description>
      <pubDate>Sat, 30 Jan 2016 02:41:35 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Downloading-windows-exe-file/m-p/166752#M6033</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2016-01-30T02:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API - Downloading windows exe file</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Downloading-windows-exe-file/m-p/166753#M6034</link>
      <description>&lt;P&gt;@Gregory, no. It's bigger, mostly. Depends on encoding. If I use ASCII enconding, then it's smaller.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;@Steve, thanks, your solution worked. Kinda. I'm a little bit rusty with VB, since I didn't use it for a long, long time. In fuction I did responsestream, and later, I had to return stream in class (form1), because file.create apparently doesn't work in async functions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is entire code, so you can see what I did.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Imports System&lt;BR /&gt;Imports System.IO&lt;BR /&gt;Imports System.Text&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Public Class Form1&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; Dim dropbox As New Dropbox.Api.DropboxClient("My token")&lt;BR /&gt; Dim responsestream As Stream&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load&lt;/P&gt;
&lt;P&gt;GetDbxUser()&lt;/P&gt;
&lt;P&gt;GetExe("/my_path", "exefile.exe")&lt;/P&gt;
&lt;P&gt;End Sub&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click&lt;/P&gt;
&lt;P&gt;Using stream = File.Create("exefile.exe")&lt;BR /&gt; responsestream.CopyTo(stream)&lt;BR /&gt; End Using&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; End Sub&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;' Dropbox Api functions&lt;/P&gt;
&lt;P&gt;Public Async Function GetDbxUser() As Task&lt;BR /&gt; Dim user = Await dropbox.Users.GetCurrentAccountAsync()&lt;BR /&gt; 'Just to check that it actually works&lt;BR /&gt; Label2.Text = "User set complete!"&lt;BR /&gt; Label3.Text = user.Email&lt;BR /&gt; End Function&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; Public Async Function GetExe(path As String, file As String) As Task&lt;BR /&gt; Dim response = Await dropbox.Files.DownloadAsync(path + "/" + file)&lt;BR /&gt; responsestream = Await response.GetContentAsStreamAsync()&lt;/P&gt;
&lt;P&gt;End Function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;End Class&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 10:51:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Downloading-windows-exe-file/m-p/166753#M6034</guid>
      <dc:creator>Anton U.</dc:creator>
      <dc:date>2016-02-05T10:51:18Z</dc:date>
    </item>
  </channel>
</rss>

