emscripten-core / emscripten-core/emscripten
WasmFS: Backends to access legacy JS FS backends
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 109
Description
Developers who use Emscripten's persistent file system backends like IDBFS have users who have data persisted in the formats used by those backends. If those developers want to migrate to WasmFS, they will still need to be able to access that persisted data via WasmFS.
One way to accomplish this would be to implement new WasmFS backends that reimplement the same storage schemes as the old JS backends. This would have the benefits of potentially being able to improve on the performance of the old backends and being able to move more code to C++, but would have the downside of needing to be bug-compatible with the older JS code.
Another way to accomplish this would be to have a small WasmFS backend that calls out to the legacy FS to reuse the legacy code directly. This would make compatibility a non-issue, but would not have any of the performance benefits that new backends might have.
Overall I would expect the second approach to be simpler and more maintainable given that we want to prioritize performance improvements and bug fixes in WasmFS and its new backends rather than in the legacy file system.
The C++ portions of existing WasmFS backends can be found in [system/lib/wasmfs/backends/](https://github.com/emscripten-core/emscripten/tree/main/system/lib/wasmfs/backends) and their JS counterparts can be found in the library_wasmfs_*.js in [src/](https://github.com/emscripten-core/emscripten/tree/main/src).
If we completed this backend bridge layer as well as the JS API bridge layer (#15976), that would allow us to enable WasmFS by default without breaking any existing programs.
Contributor guide
Assessment
This issue has not been assessed yet.