Page 1 of 1

Progressbar for download file

Posted: Thu May 11, 2023 6:08 pm
by papiosaur
Hello,

i would like to add a progress bar indicated bytes donwloaded but i unknow variable for that.

I use DownloadFile() command to download.

I have read hurl doc and found #CURLINFO_SIZE_DOWNLOADED but don't work...

Do you have a simple example please ?

Thanks a lot !

Re: Progressbar for download file

Posted: Sat May 13, 2023 9:41 am
by papiosaur
i must obligatory open a hurl session with e = hurl.Easy() to get variable with GetInfoContent_Lengh_Download_t() ?

Re: Progressbar for download file

Posted: Sat May 13, 2023 8:42 pm
by airsoftsoftwair
You can pass a callback function to DownloadFile() which will be called repeatedly while downloading is in progress so this callback could be used to update a progress bar.

Re: Progressbar for download file

Posted: Sun May 14, 2023 8:25 pm
by Flinx
Here is an example. The password has yet to be inserted.

Code: Select all

Function ProgressBar(msg)
	DebugPrint(ToString(Int(msg.Count/msg.Total*100)).."%")
	Return(False)
EndFunction
passw$="" ; get the password from here: https://dlptest.com/ftp-test/
For i=1 To 2^14 ; 16k random characters
	data$=data$.. Chr(32+Rnd(93))
Next
UploadFile  ("ftp://dlpuser:"..passw$.."@ftp.dlptest.com/test.bin", {Data = data$})
DownloadFile("ftp://dlpuser:"..passw$.."@ftp.dlptest.com/test.bin", {File = "test.txt"},ProgressBar)


Re: Progressbar for download file

Posted: Sun May 14, 2023 11:58 pm
by papiosaur
Thanks a lot Flink!

With help of your example my code work now!