netmaster It's not clear what you mean by "*** mode". All I can say, is that there are only two possible ways to download multiple files in browser, and at some point you will hit the wall.
- Zip the files in real-time on server (PHP) and serve the zip to browser.
- Download the files first into browser, then zip them for output.
netmaster In "browser" mode, download took 5m33s, but resulting zip file was only 2GB in size and contained 1 mp4 file. Whole process was really memory hungry, and after memory runs out, Chrome and whole PC started to struggle. Probably because of swapping.
As noted previously, this could be some max 2GB value in your browser for downloading files as BLOBS. I'm not sure if they temporarily go into memory or disk, but it's likely there is a limit yet.
netmaster In "zip" mode download was visually no difference from browser mode. I could not detect any zipping action in server either. php8.2-zip is installed and according to phpinfo() is enabled as well. Anyway, after 7m45s download suddenly ended with the red boxed UI message "Array buffer allocation failed" and zip file was nowhere to found.
Created zip of same files in the shell (with -0 switch) and this took only 23s. Making zip file and downloading it from pipe or disk would be very acceptable, but for some reason it is not doing that.
Do you mean config option download_dir set to zip
? If set correctly, it would create the zip on server, and it would then need to store the temp zip file (10GB?) on server. I doubt very much that your server is capable of doing that. However, regardless of if the setting was assigned correctly or not, it clearly failed (and it therefore seems pointless to diagnose that).
By default, Files Gallery would cache zip files in the dir, so it would be found there if it got created successfully. I doubt that very much though. PHP will normally fail on less than 100MB, although in your case maybe it's faster if there are fewer files, and if your server is powerful.
netmaster Created zip of same files in the shell (with -0 switch) and this took only 23s.
And how large was that zip file? PHP has a timeout of 30 seconds by default, so it would often timeout before it can succeed. Besides, we are talking about a process that takes 23s before it can even return anything at all the browser ... The user will just be thinking "this isn't working", and the browser might even timeout. Also, PHP simply isn't "shell".
netmaster Making zip file and downloading it from pipe or disk would be very acceptable, but for some reason it is not doing that.
It seems you have unreasonable expectations for what can dynamically be downloaded as zip from your web browser. Did you try any other web apps that could do something like this? There is no concept of "pipe" in PHP or browser. We either need to pre-create the zip file on server with PHP (slow, requires loads of storage, will timeout), or we need to download the files separately into browser, before zipping them into a single file response.
Your only option for max efficiency, would perhaps be to use shell commands to create the zip (instead of PHP), but this will certainly be loaded with flaws also. If your shell takes 1min+ to create the zip file, it means you will need to extend PHP timeout value beyond 1 min. Also, there will be nothing served to browser/user until the file is zipped, so the user will be waiting, and it's likely the browser request will timeout.
netmaster In "files" mode download was again visually similar to browser mode, but ended with total crash of the chrome.
That's why I didn't mention it previously. It's actually a third option, that simply triggers multiple downloads in browser, without zipping the file. So apparently, if you trigger multiple GB downloads in your browser, it will crash. It doesn't work.
netmaster I dont know, how last two options supposed to look like, but it seems to me, that they all using the same browser method.
No. The "files" method doesn't zip the files. It just downloads them. It's like clicking "download" for multiple files very fast, except you don't need to do it yourself.
The "zip" method zips on server. If it didn't do that, you would see the same error as in your first attempt. Or maybe that's what you are seeing.
netmaster If you say that multi-file download in browser isn't possible what
'download_dir' => 'files', // Non-zip multi-file download in browser, desktop only.
actually means?
It's a hacky solution. It basically triggers download "click" on multiple downloads simultaneously. If you try it on for example 10x normal-sizes jpg images, it will work fine. However, browsers are not meant to support this. It definitely does not work on mobile, and we can see it crashes your browser on multiple large files.
netmaster It seems that this multi-file options would be best
If you mean download multiple files without consolidating into a zip file, no that's not possible. The 'files' option attempts to emulate this, but it's a "hack", and normally it raises an alert in browser "Attempting to download multiple file. Allow?".
There is a reason that downloading multiple files in browser is not allowed from a single operation. What happens if some malicious website starts download 1000 files? When there is one download, the browser can intercept it, verify it, and the human user can easily find the download.
netmaster I can swear I have seen that method in action somewhere. Probably in Synology or Qnap NAS'es but i'm not sure.
Unfortunately no.