Progressbar for download file

Find quick help here to get you started with Hollywood
Post Reply
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Progressbar for download file

Post 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 !
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Progressbar for download file

Post by papiosaur »

i must obligatory open a hurl session with e = hurl.Easy() to get variable with GetInfoContent_Lengh_Download_t() ?
User avatar
airsoftsoftwair
Posts: 5450
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Progressbar for download file

Post 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.
Flinx
Posts: 192
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Progressbar for download file

Post 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)

papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Progressbar for download file

Post by papiosaur »

Thanks a lot Flink!

With help of your example my code work now!
Post Reply