rejetto forum

Disable ZIP download if folder bigger than 2GB?

Novox · 15 · 16863

0 Members and 1 Guest are viewing this topic.

Offline Novox

  • Occasional poster
  • *
    • Posts: 84
    • View Profile
Hello rejetto,

Is it possible, if I want to make an event that disable download as zip's button when the folder is bigger than 2GB?

Thanks in advanced!


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
maybe it's possible to make a [download] event where you call a command-line utility to get the size of the archive.
anyway, this is not a good method, because the archive is not necessarily a full folder.
problem is, the [download] event is fired before the archive is calculated (and this must stay this way), so hfs cannot even pass you the size.

i don't know if we should introduce a new event for archives.
opinions?


Offline Novox

  • Occasional poster
  • *
    • Posts: 84
    • View Profile
Yeah, I think a new event for archive is required to solve this problem. Or can you give a archive setting option in HFS instead of using event script?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
i found that event [archive name] is when the archive is ready.
so i just introduced a new symbol %stream-size% so you can now ALT+F6 and put this

[+archive name]
{.if|{.%stream-size% > 2000000000.}|{:
  {.disconnect reason|archive too big.}
:}.}


Offline Novox

  • Occasional poster
  • *
    • Posts: 84
    • View Profile
WoW Thank you very much rejetto! You are the best!

This will come in the new b263 right? I waiting for it :)
« Last Edit: July 27, 2010, 09:11:00 AM by Novox »



Offline DAD1977

  • Occasional poster
  • *
    • Posts: 6
    • View Profile
Hallo, rejetto.

The use of scripts is very helpful in the work site.
I want to put a limit to download as a tar-file folders larger than 2 GB.
But the above script does not work .
[+archive name]
{.if|{.%stream-size% > 2000000000.}|{:
  {.disconnect reason|archive too big.}
:}.}
I experimented with a limit of 2 MB.
Function %stream-size% produces a result of "0".
As a result, disconnect does not occur and the tar-file is downloaded.

I use  build 293.

Thanks.
« Last Edit: April 23, 2015, 12:35:32 PM by Tranzit »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
i don't remember if it ever worked and why, anyway at the moment of [archive] the download is not ready and the size is not known, so it is currently normal that it doesn't work.
I had to introduce a new event [stream ready]
and to know if a download is an archive you can now use %is-archive%

So, the result shall be

[+stream ready]
{.if|{.and| %is-archive% | {.%stream-size% > 2000000000.} .}|{:
  {.disconnect reason|archive too big.}
:}.}


But this will work only with next release, version 2.3f
and be careful as i didn't test it :P would you? this is a preview http://ge.tt/1kuGSaF2/v/0
if you give me your ok i will publish it


Offline DAD1977

  • Occasional poster
  • *
    • Posts: 6
    • View Profile
Hallo.
This script is not working. I try your option:
... > 2000000 ...
conversely
... < 2000000 ...
and experimented with script:
Code: [Select]
[+ stream ready]
{.if | {.% is-archive%.} | {:
  {.disconnect reason | archive too big.}
} . }
and
Code: [Select]
[+ stream ready]
{.if | {.% stream-size%> 2000000 .} | {:
  {.disconnect reason | archive too big.}
} . }

But the result is not available; HFS did not respond to the script; restart HFS does not work too.
I used:
- Windows 8.1 with IE11 and Mozilla 29
- Windows XP SP3 with IE8 and Mozilla 9

my opinion: limit the size of the archive is very important, because a many long time (~30 hours) multiple simultaneous downloads use a lot of RAM. Usually, I get an error "Out of memory" when the size of the allocated RAM for HFS is about 1.8 GB.

P.S.: There is a wish:  in HFS box with info about current connections add the ability to sort the data in columns: IP-address, File, Time.....  This function helps quickly navigate the data, when more than 20 downloads in window HFS.

Thank you for the program.
« Last Edit: May 06, 2015, 05:46:32 AM by Tranzit »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
@rejetto
[stream ready] is  not defined in sources as Event


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
Hi!

@Mars

Ce sera pour la version 2.3f, rejetto lui poste juste une version de test pour le moment.
++


But this will work only with next release, version 2.3f
and be careful as i didn't test it :P would you? this is a preview http://ge.tt/1kuGSaF2/v/0
if you give me your ok i will publish it


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
hi Silent
comme tu peux le constater, la vieillesse s'installe aussi chez moi, j'avais pas lu la fin du message de maximo ;)


Offline DAD1977

  • Occasional poster
  • *
    • Posts: 6
    • View Profile
But this will work only with next release, version 2.3f
and be careful as i didn't test it :P would you? this is a preview http://ge.tt/1kuGSaF2/v/0
if you give me your ok i will publish it

I realized that this was a reference to the test version 2.3f with [stream ready]. This version I downloaded and tested, but [stream ready] not worked.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
there was a typo in my script.
anyway, there's still a problem that i have to fix (no error page is supplied) before releasing a new version.
this is the corrected script:

[+stream ready]
{.disconnection reason|archive too big|if={.and| %is-archive% | {.%stream-size% > 2000000000.} .}.}


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile