-
Notifications
You must be signed in to change notification settings - Fork 267
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
Browser storage support in WebAssembly bindings #531
Comments
Related to tursodatabase#531 Add support for OPFS in WebAssembly bindings for browser storage. * **bindings/wasm/lib.rs** - Update `Database` constructor to handle OPFS option. - Modify `PlatformIO` to use OPFS for I/O in the browser. * **bindings/wasm/vfs.js** - Replace Node `fs` module with OPFS API. - Implement OPFS methods for `open`, `close`, `pread`, `pwrite`, `size`, and `sync`. * **bindings/wasm/docs/api.md** - Update documentation to mention OPFS support. - Add examples demonstrating usage with OPFS. * **bindings/wasm/examples/drizzle.js** - Update example to use OPFS for database storage. * **bindings/wasm/examples/example.js** - Update example to use OPFS for database storage. * **bindings/wasm/integration-tests/tests/test.js** - Update tests to use OPFS for database storage.
I just looked into it and synchronous OPFS is not that simple. There is Now that I'm writing this I figured there's also the option to expose an in-memory only db client, and let the API consumer just dump the db (raw bytes or sql dump) to be persisted however the consumer wants, be it OPFS, base64'd into LocalStorage, sent to a backend, or any other less than perfect option, but that is very much a bandaid solution since it would be impossible to guarantee that it gets persisted correctly and safely, among a myriad of other issues |
Hi, @penberg . I am interested in this issue. as @BLucky-gh said it can only be synchronous inside web worker. So, I am doing it in async keeping vfs as reference. Can you assign this issue to my name? |
Hey @Dharshan-K, we don't really assign issues to anyone. If you want to work on this, please come over to Discord, for example if you want to coordinate your work. |
ok sure. will post there. |
Currently, the Wasm binding implement I/O for Node filesystem APIs. Let's work on supporting OPFS, for example, to run
limbo-wasm
in the browser. One complication is that the current API is synchronous likebetter-sqlite3
so we either need to use synchronous OPFS or implement libSQL async-style API.The text was updated successfully, but these errors were encountered: