-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Investigate adding Filesystem access with the File and Directory Entries API #586
Comments
There is a good introductory document on this API here: https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction It includes amongst the use cases:
The mention of large files > 1GB sounds promising. This is also stated:
(It actually says "uploads" where I've put "file access", but this is in the context of a file-uploader example.) |
So, having looked into this, it seems there is no way to store a file handle between sessions using this API, even for read-only. EDIT: If the file is stored in the virtual file system, then it can be accessed across sessions. However, given the large size of our files and the fact that the browser manages the storage, probably on the System drive, this seems useful only for a small ZIM file. I think this is rather similar to what Firefox is doing on Android: when you pick a file, it copies it to its own virtual filesystem, but with our files, this takes several seconds and is not very convenient. A better upcoming API for our purposes might be the Native File System API which is currently Chrome only and behind an experimental flag. There is an explanation here: https://web.dev/native-file-system/ . This includes the following statement:
So this technology would be used alongside #388. WC3 has a draft spec, but it is not on standards track: https://wicg.github.io/native-file-system/ . This could be quite promising if Mozilla gets on board. |
The main issue with the "File and Directory Entries API" is that, as far as I understand, you can not read files in the actual filesystem of the device, but only in the sandboxed filesystem. And this sandboxed filesystem can not be accessed outside the app. The "Native File System API" looks more promising, but it's currently not implemented anywhere (except on Chrome behind a flag) : https://caniuse.com/#feat=native-filesystem-api |
Yes, I came to the conclusion that the File and Directory Entries API, while a lot better supported recently than the old Chrome-only Filesystem API (basically because the other browsers were forced to implement parts of it or see their browsers fail on popular sites) is only useful for downloading a smallish (e.g. up to size of WikiMed) ZIM and storing it in the sandboxed File System. If this could be done on user request, it would be an advance: you then have a two-part "Packaged App" - download the app (or install as PWA) and the app then downloads the ZIM file it needs to complete its "installation". It could also incorporate a check for an updated ZIM on user request (or use notifications). However, a lot of other development would be needed to get to that... |
This issue can be closed because the Native File System API is superior and working in Kiwix JS Windows. |
This API is relatively new, not yet standardized, but seems to have good asynchronous support for read-only, which is what we want. See:
https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API
The text was updated successfully, but these errors were encountered: