rejetto forum

downloading big files

0 Members and 1 Guest are viewing this topic.

Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13521
    • View Profile
hello,
referring to this post
you can download a file by using commands {.load.} and {.save.}

{.load|http://rejetto.com/hfs/download|var=#x.}
{.save|test.exe|var=#x.}

the url in the example will download HFS program.
but this may lead to memory problems for bigger files, so this is a script to download the file 1MB at time

Quote
{.set|#url|http://surfnet.dl.sourceforge.net/project/nmapwin/nmapwin/1.3.1/nmapwin_1.3.1.exe.}
{.set|#out|test.}

{.set|#from|0.}
{.set|#chunk|1000000.}
{.save|{.^#out.}|.}
{.while|#chunk|{:
   {.load|{.^#url.}|var=#x|size={.^#chunk.}|from={.^#from.}.}
   {.if|{.length|var=#x.}
      | {:{.append|{.^#out.}|var=#x.}
         {.inc|#from|{.length|var=#x.}.}
        :}
      | {:{.set|#chunk|0.}:}.}
:}|timeout=0.}

all variables are in the #global form because i made this in the "run script" window.
i wish someone to continue this work and get something people can integrate in their template.

this requires some bugfixes available in #248 that i'm going to publish now.

because of the bugs, this took me 2 hours   :'(
« Last Edit: May 20, 2018, 01:13:23 PM by Mars »