Author Topic: Disable ZIP download if folder bigger than 2GB?  (Read 4873 times)

0 Members and 1 Guest are viewing this topic.

Offline Novox

  • Occasional poster
  • *
  • Posts: 84
    • View Profile
Disable ZIP download if folder bigger than 2GB?
« on: May 25, 2010, 08:58:01 AM »
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: 12890
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #1 on: May 29, 2010, 06:15:45 PM »
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
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #2 on: July 15, 2010, 06:30:44 AM »
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: 12890
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #3 on: July 27, 2010, 08:10:39 AM »
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
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #4 on: July 27, 2010, 08:42:38 AM »
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 rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12890
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #5 on: July 27, 2010, 01:57:34 PM »
yes

Offline Tranzit

  • Occasional poster
  • *
  • Posts: 6
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #6 on: April 23, 2015, 12:17:42 PM »
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: 12890
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #7 on: May 01, 2015, 02:36:48 PM »
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 Tranzit

  • Occasional poster
  • *
  • Posts: 6
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #8 on: May 05, 2015, 07:37:08 PM »
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: 1842
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #9 on: May 06, 2015, 11:12:58 PM »
@rejetto
[stream ready] is  not defined in sources as Event

Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
  • Posts: 1181
  • ....... chut ! shh!
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #10 on: May 11, 2015, 11:40:32 AM »
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: 1842
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #11 on: May 11, 2015, 08:24:45 PM »
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 Tranzit

  • Occasional poster
  • *
  • Posts: 6
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #12 on: May 13, 2015, 08:08:36 AM »
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: 12890
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #13 on: May 17, 2015, 11:58:16 PM »
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: 12890
    • View Profile
Re: Disable ZIP download if folder bigger than 2GB?
« Reply #14 on: May 18, 2015, 10:35:57 AM »
ok, i also fixed the bug.
this is the new experimental exe
http://ge.tt/7esYeaG2/v/0