SqliteWasmHelper
SqliteWasmHelper copied to clipboard
Connect to Indexdb
Jeremy! you did a great job. Thank you.
It has been a week that I am searching in internet and your version of storing SQLite inside browser is by far the cleanest implementation.
You are the only person talking about storing in Cache instead of IndexedDB .
1- What are the differences, pros and cons of storing in cache or IndexedDB ?
2- What is the limitation maximum size of a file in browser Cache?
3- I tried to replace your JavaScript (browserCache.js) with StevenSanderson's one (https://github.com/SteveSandersonMS/BlazeOrbital/blob/main/BlazeOrbital/ManufacturingHub/wwwroot/dbstorage.js) but unfortunately it doesn't work properly. I see the SqliteStorage in IndexedDB but cannot retrieve it.
Can you kindly give us a working Javascript version for Indexedb please?
@JeremyLikness FWIW I would also be interested in this. Perhaps an option to use either?
I'd be open to the option. My take on IndexedDB is that, well, it has it's own SQL-like interface so what is this buying you? I understand the database table can be stored as a blob but then you're, well, just storing it as a blob.
- Pros/cons - pro is an easier/straightforward interface for cache, and also easiest to provide the file as a response to download. con is less space. IndexDb is a far more complex interface.
- 50 MB I believe
- I figured anyone using indexeddb would just use Sanderson's, and go to this for cache API
Browsers can store up to 5 MiB of local storage, and 5 MiB of session storage per origin. I too like the idea of storing the DB inside IndexedDB. Yes, it's more complex. But, there is potentially far more storage available. The amount of storage available is browser dependent. Typically it's 10%-20% of the total disk size, though Chromium based browsers offer up to 60%. You can use navigator.storage.estimate()
to see how much is available.
While we're on the topic, why not utilize Origin Private File System? Same storage capacity of IndexedDB without the overhead of IndexedDB or Filesystem API. The browser cache just seems so limiting in terms of size.