SqliteWasmHelper icon indicating copy to clipboard operation
SqliteWasmHelper copied to clipboard

Connect to Indexdb

Open syazdian opened this issue 1 year ago • 3 comments

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. image Can you kindly give us a working Javascript version for Indexedb please?

syazdian avatar May 01 '23 00:05 syazdian

@JeremyLikness FWIW I would also be interested in this. Perhaps an option to use either?

Eddie-Hartman avatar Jul 06 '23 01:07 Eddie-Hartman

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.

  1. 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.
  2. 50 MB I believe
  3. I figured anyone using indexeddb would just use Sanderson's, and go to this for cache API

JeremyLikness avatar Oct 17 '23 18:10 JeremyLikness

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.

sidmcfarland avatar Oct 18 '23 14:10 sidmcfarland