[Gambas-user] File Downloading
Charlie Ogier
charlie at cogier.com
Thu Mar 1 14:42:45 CET 2018
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:
> RE: [Gambas-user] File Downloading
>
>
>
> 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 to
> https://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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180301/63fb7b97/attachment-0001.html>
More information about the User
mailing list