[Gambas-user] File Downloading

Shannon Kuchler shannon at inflecto.org
Thu Mar 1 17:04:33 CET 2018


Thanks Charlie

the code I'm actually using at the moment is below

but in this case I'm having issues with stopping execution if the process is killed before the download is completed

and I cant find any way to get user feed back via a progressbar. gb.net.curl seemed easier to manage if I could get it working reliably.



Public Sub DownloadFile()

Dim p1 As Process

p1 = Shell "wget -P" & " " & "/tmp/mi4l/" & " " & TextBox2.Text For Input As "Process"

End












 
 
Hi Shannon,
 
 Try this: -
 
 Public Sub Main()
 
 If Not Exist("/tmp/mi4l") Then Mkdir "/tmp/mi4l"
 Shell "cd /tmp/mi4l && wget https://github.com/SphereII/SMXBigBackPack/archive/master.zip" 
 
 End
 
 If it does not work make sure you have 'wget' installed.
 
 Charlie
 
 
 On 01/03/18 01:19, Shannon Kuchler wrote:
 
 


 

 

opps I forgot I'm using Gambas 3.10
 

 


 

 -----Original message-----
 From: Shannon Kuchler <shannon at inflecto.org>
 Sent: Wednesday 28th February 2018 19:18
 To: Gambas Mailing List <user at lists.gambas-basic.org>
 Subject: [Gambas-user] File Downloading
 
 
 

Total noobie here
 

 


 

 

I have searched and searched and can't seem to figure this out

 

I simply need to download a file
 

 


 

 

The problem is this code works when it feels like it. When it works it works great. When it doesn't work it just creates the temp.zip and does nothing.

 

It doesn't raise an error so I don't know what's going on.

 

  
 

 

On top of that I can't get it to download if the url is redirected 
 

 

for example I want to download this file  https://github.com/SphereII/SMXBigBackPack/archive/master.zip 

 

but the url is redirected tohttps://codeload.github.com/ClockworkOrange420/7-Days-to-die-Unofficial-XML-Fixes/zip/master 
 

 


 

 

Ideally I want to download master.zip from https://github.com/SphereII/SMXBigBackPack/archive/master.zip and save it to /tmp/mi4l/master.zip 
 

 


 

 


 

 


 

 


 

 

Public hGetFileClient As New HttpClient As "hGetFileClient" Private sDownloadBuffer As String

 

Public Sub DownloadFile()

 


 

 

hGetFileClient.URL = URL
 hGetFileClient.TimeOut = 0
 hGetFileClient.Async = True
 hGetFileClient.Get([], "/tmp/mi4l/" & "temp.zip")

 


 

 

end
 

 


 

 

Public Sub hGetFileClient_Error()
 
   hGetFileClient.Stop()
   Message("Error: Downloading")
 End

 


 

 


 

 

Public Sub hGetFileClient_Finished()

 


 

 

Shell "unzip -o /tmp/mi4l/*.zip" & " -d " & "/tmp/mi4l/" Wait

 


 

 

end
 

 


 

 


 

 


 

 


 

 
 

--------------------------------------------------



This is the Gambas Mailing List:

https://lists.gambas-basic.org/listinfo/user



Search the list:

https://lists.gambas-basic.org/cgi-bin/search.cgi



Hosted by https://www.hostsharing.net



 
 
 

--------------------------------------------------

This is the Gambas Mailing List:
https://lists.gambas-basic.org/listinfo/user

Search the list:
https://lists.gambas-basic.org/cgi-bin/search.cgi

Hosted by https://www.hostsharing.net


 
 



--------------------------------------------------



This is the Gambas Mailing List:

https://lists.gambas-basic.org/listinfo/user



Search the list:

https://lists.gambas-basic.org/cgi-bin/search.cgi



Hosted by https://www.hostsharing.net



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180301/33431f9f/attachment-0001.html>


More information about the User mailing list