Open penberg opened 4 months ago
Hey 👋 Thanks for creating this ticket. The reason I suggested to use the Node.js file system is because the db file would be persisted across reloads as it could be written to the host file system (the host here is WebContainer). AFAIK libsql was compiled via Emscripten so instead of using an in-memory file system there could be a version that uses Node's raw file system via NODERAWFS
. This means nothing has to be mounted and it would directly use the Node FS.
Or potentially, if this is meant to be used via Node.js always then maybe we can make it the default and if we wanted a browser version then we could publish a separate *-web
package maybe.
I looked into this with @d3lm and we likely want a VFS implementation that uses Node filesystem API that we can plug into the SQLite/libSQL Wasm build.
Here's one implementation of the VFS approach for upstream SQLite: https://github.com/tndrle/node-sqlite3-wasm
I am working on "Drizzle play" that relies on WebContainer. It would definitely help to have this feature!
Suggested by Dominic Elm.