Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox got a File System API! #122

Open
opusforlife2 opened this issue Mar 21, 2023 · 9 comments
Open

Firefox got a File System API! #122

opusforlife2 opened this issue Mar 21, 2023 · 9 comments

Comments

@opusforlife2
Copy link

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
Copy link
Author

Hi, could this issue please be triaged?

@diegocr
Copy link
Contributor

diegocr commented Apr 15, 2023

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.

@opusforlife2
Copy link
Author

opusforlife2 commented Apr 15, 2023

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.

@diegocr
Copy link
Contributor

diegocr commented Apr 15, 2023

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.

@opusforlife2
Copy link
Author

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
Copy link
Author

@diegocr Any news on supporting this API?

@diegocr
Copy link
Contributor

diegocr commented Jun 11, 2023

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

@opusforlife2
Copy link
Author

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.

@gabianastasie

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants