Closed jlarmstrongiv closed 1 year ago
Thanks for the suggestion! This project is a playground for working with snippets of SQL code. It does not support large databases by design, and probably never will. At least not until I have a very compelling reason to spend a week of my time implementing that support.
ArrayBuffer limitations
Currently, SQLite databases are loaded using arraybuffers:
Arraybuffers have limited sizes:
String limitations
Or by loading text:
Strings have limited sizes:
Solutions
Streams API / Web Streams API
To handle larger files, it is possible to use Web Streams:
WebAssembly.Memory
A workaround to creating a larger array buffer is using
new WebAssembly.Memory
However, I think using the Streams API is a better fit.
Other
I was looking at the implementation:
And I’m thinking that if OPFS VFS support is active, then we can stream the db file to the OPFS VFS, and then open the DB from the file we created.
Using OPFS requires cross-origin isolation (COOP and COEP), which can be added to GitHub pages with coi-serviceworker.