jprendes/emception

[Question] How does SHAREDFS work?

NovaAndrom3da opened this issue · 2 comments

Out of curiosity, how does the sharedfs work? Is it a temporary virtualized filesystem? Or is that saved to an indexedDB? Or is it the user's local filesystem?

Hi!

SHAREDFS is intended to share a filesystem between different Emscripten modules. You need a first module with a "normal" FS, and then you can share it with other modules using SHAREDFS. It is inspired by Emscripten's PROXYFS.

SHAREDFS will share the whole root, except for a few directories, like /proc and /dev since those contain module specific files (like stdin and stdout).

In the case of Emception, there's a root module that "owns" the filesystem. The root of that filesystem is a MEMFS, which is an in memory virtualized filesystem in JavaScript. However, the /emscripten/cache directory is mounted using IDBFS, which persists the data in an IndexedDB.

Hope that helps!

Do you have another application in mind for it?

Sorry for the late response, I'm working on getting a linux environment running entirely in the browser - BrowserLinux - and was intrigued by emception. I am working on adding a "complete filesystem" in IndexedDB with pre-written methods of reading and writing pseudo-"files" that would be accessible to the programs compiled to wasm. If I am able to combine that "filesystem" with SHAREDFS, that would be highly beneficial.