webclient icon indicating copy to clipboard operation
webclient copied to clipboard

Firefox got a File System API!

Open opusforlife2 opened this issue 1 year ago • 9 comments

https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API#origin_private_file_system

I don't know if any devs here have been keeping tabs on this. Will this finally allow Mega to directly write to the filesystem via Firefox?

opusforlife2 avatar Mar 21 '23 15:03 opusforlife2

Hi, could this issue please be triaged?

opusforlife2 avatar Apr 15 '23 18:04 opusforlife2

Hi @opusforlife2, yeah it has been on our radar and we made a PoC when it was still under a draft, the main inconvenient we found back then is that it does requires a user gesture to get access to, which may not be a big deal for our downloads page where a single download can be initiated, but i think it won't be quite pleasant to work with over the cloud-drive and/or folder-links to trigger multiple downloads at once.

Since the spec have just been standardized we shall check if this is still on the same state and requirements. Anyway, nowadays Firefox can handle in-memory downloads of up to 6 GB, so we may could at least consider supporting it over the downloads page for any file bigger than that.

diegocr avatar Apr 15 '23 20:04 diegocr

Well, device RAM limitations still play a role, I think. For my 4 GB RAM, any file bigger than, say 2 GB, starts to cause major browser hangups.

The first bulleted point on the linked page says:

Permission prompts are not required to access files in the OPFS.

opusforlife2 avatar Apr 15 '23 20:04 opusforlife2

That's correct, paging memory to disk could play bad here depending the computer characteristics and Firefox version, are you in the latest? Perhaps we could also try to improve it, since i don't remember hearing about browser freezes from this, so if you're in the latest version things may changed here, if you would like to help troubleshooting you can enable debugging logs by going to http://mega.nz/debug, then do start such a download and when the freezes does happen save the web-console logs to a file and send it to us by email to [email protected] with a link to this Github ticket and they will forward it to me.

Permission prompts are not required to access files in the OPFS.

Yeah, but we do still have to bring up the file-picker dialog at least once for the user to choose the output file, then the file-system handle to that file can be stored e.g. into indexedDB so that it can be reused without any further prompt, this is not very convenient for standard downloads, only in the case of the download being interrupted and having to be resumed it will be of help. For what multiple downloads concerns, if we can reliably get a handle to a whole directory (like former legacy Firefox extensions was allowed to do) then things will be much better.

diegocr avatar Apr 15 '23 21:04 diegocr

paging memory to disk

It's basically this. If a file is too large, it can bring the entire system, let alone the browser, to a crawl. Eventually, the save dialog does appear and the problem is resolved, but you can imagine how much time an old HDD would take for paging.

opusforlife2 avatar Apr 16 '23 05:04 opusforlife2

@diegocr Any news on supporting this API?

opusforlife2 avatar Jun 07 '23 23:06 opusforlife2

Hello @opusforlife2, sorry cannot yet provide an estimated date when this will be available, but i'll post back here whenever it's done. Let me say we're currently quite busy working in an upcoming product under the name S4, which btw will also allow for flawlessly downloads, you may read about it here: https://twitter.com/MEGAprivacy/status/1478426955292692482

diegocr avatar Jun 11 '23 10:06 diegocr

Oh, I wasn't asking for an ETA. Just some idea of whether this API is usable for the purpose of making larger downloads viable for RAM-poor devices.

If that's the case, then it will surely happen eventually. No hurry there.

opusforlife2 avatar Jun 11 '23 15:06 opusforlife2

@opusforlife2 Boycott MEGA! https://web.archive.org/web/20231101003041/https://github.com/meganz/webclient/issues/135

MEGA desperately tries to cover up abuse. MEGA even deleted the above-mentioned post, but we used archive.org to save it.

Don't give your money to low-down individuals that harm a mentally ill person. Don't associate yourself with such scoundrels.

gabianastasie avatar Nov 03 '23 00:11 gabianastasie