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

OPFS support (WASI host file system access / File Access API) #8

Open
kesavkolla opened this issue Feb 14, 2025 · 3 comments
Open

OPFS support (WASI host file system access / File Access API) #8

kesavkolla opened this issue Feb 14, 2025 · 3 comments

Comments

@kesavkolla
Copy link

Can we use JavaScript File APIs or OPFS to store the document and load the document from there to zeta? This would be a killer feature. In general emscripten support WasmFS which can be used for any of the supported backends.

Another great thing would be to do WASI support. Some of the modern browsers (Chrome and Edge) do support WASI. WASI does have File access API.

@stbergmann
Copy link
Collaborator

Thanks for your interest in these areas. For now, ZetaOffice itself sees just the in-memory file system provided by Emscripten. Any interaction with other file systems (the system one, through File System API or File System Access API; or OPFS) would need to go via surrounding JS code like in https://github.com/allotropia/zetajs/tree/main/examples/convertpdf.

However, LibreOffice internally uses a file-system/general-URL-based-resources access abstraction (UCB) that would allow to add a new URL schema and handler for a file system. That might be a way to experiment with internal support for e.g. File System Access API or OPFS.

@kolAflash
Copy link

kolAflash commented Feb 18, 2025

Sounds like some interesting thoughts!

You can simply use WASI and OPFS from JavaScript and pass the files to ZetaOffice. For many scenarios like a highly integrated web-app this should be well suited.
But for more general web-office approaches it would be nice, if ZetaOffice can directly see the hosts file system via WASI and OPFS.

On the other hand, something like "host file system access" will probably maybe be supported on host platforms which don't really expose a file system to the user. Thinking about iOS.

 

I'll add a few links for the abbreviations.

@kolAflash kolAflash changed the title OPFS support OPFS support (WASI host file system access / File Access API) Feb 18, 2025
@kolAflash
Copy link

@kesavkolla
Can you give a hint on how to configure Emscripten, to mount a folder from the host into it's virtual file system?

I also found NODEFS. But it's said, that it only works in NodeJS but not in Chrome.
https://emscripten.org/docs/api_reference/Filesystem-API.html#nodefs
JS seems to be: FS.mount(NODEFS, { root: '.' }, '/mnt');
(not tested)

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