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

Use File System API #71

Open
benbucksch opened this issue Dec 18, 2023 · 1 comment
Open

Use File System API #71

benbucksch opened this issue Dec 18, 2023 · 1 comment

Comments

@benbucksch
Copy link

benbucksch commented Dec 18, 2023

The File System API allows to read and write native files on disk of the host system, and make in-place writes. There's a dedicated file system (called Origin private file system / OPFS) that websites can access without having to first prompt the user for access, but that's sufficient for the purposes of a database. Reads happen via File / Blob and writes using WritableStream. I have not researched how random access read/write works.
(The File System Access API is a different variation of the API, for arbitary file access using a file picker, and cannot write in-place, so it's not relevant here.)

It seems that all major browsers implement it now, aside from Android WebView: Chrome desktop, Chrome Android, Firefox, Safari Mac and iOS, Samsung Android browser.

To avoid the overhead of using IndexedDB as storage, the File System API should be used as FS implementation of absurd-sql, hopefully making it considerably faster. The goal is to come close to native speed of sqlite.

@edmofro
Copy link

edmofro commented Apr 11, 2024

I've been looking around this space today, and for others who come later, there is also https://github.com/rhashimoto/wa-sqlite and the official https://www.npmjs.com/package/@sqlite.org/sqlite-wasm, both of which have OPFS support

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

2 participants