absurd-sql icon indicating copy to clipboard operation
absurd-sql copied to clipboard

Use File System API

Open benbucksch opened this issue 6 months ago • 0 comments

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.

benbucksch avatar Dec 18 '23 06:12 benbucksch