It'll be useful to have IndexedDB in Deno.
Related to #1657.
Should we use pure TS implementation or on the Rust side?
Or use ready-made C++ implementations
https://cs.chromium.org/chromium/src/content/browser/indexed_db/
This is really complicated when you dig into it.
There is no Rust implementation of IndexDB (there is a crate that appears to be squatting, but it really isn't an implementation). Servo does not support IndexedDB, they have a long standing issue to implement. So on the Rust front it is sort of a dead end.
In Node.js, there are no realistic implementations either. Again there is a package squatting on indexeddb, but it isn't really a good package at all. The one thing that seems to have promise is IndexedDBShim which sits on top of WebSQL, and there are native implementations of WebSQL on Node.js using sqlite3.
jsdom doesn't implement IndexedDB or WebSQL, though there is this issue talking about implementing the IndexedDB shim mentioned above, I assume requiring the WebSQL implementation. It looks like it is stalled.
There is also an in memory IndexedDB API written in TypeScript.
There is what looks like a realistic Rust create for sqlite3.
So outside of using a C++ implementation, which would be a break in the pattern, the only realistic path I can easily see is that to use the in memory IndexedDB written in TypeScript, which would not give persistent storage, or we could adapt the in memory version and wire it up to a Rust sqlite3 bindings to persist the data.
I don't think just persisting out to JSON really works, because IndexedDB is a bit more complex than that, it contains concepts like transactions and other database features which is why almost all the browser implementations are based on sqlite3 IIRC.
Just updating this, servo still doesn't have it, and Gecko is looking at refactoring, but it is sqlite3 under the hoods. Here is a the most recent post that lays things out most relevantly: https://github.com/servo/servo/issues/6963#issuecomment-528852316.
It would be really good to get localStorage/IndexedDB/kv-store in to Deno, IMO.
deno embrace web standard, indexeddb is one of web standard. so deno must have indexeddb!
@ry ,Are you going to ignore it again? like you ignore many things about nodejs.
@anlexN your comment is borderline abusive. The issue is well discussed here of how it is a complex issue. Please keep your conversation civil and on-topic.
Most helpful comment
Just updating this, servo still doesn't have it, and Gecko is looking at refactoring, but it is sqlite3 under the hoods. Here is a the most recent post that lays things out most relevantly: https://github.com/servo/servo/issues/6963#issuecomment-528852316.
It would be really good to get localStorage/IndexedDB/kv-store in to Deno, IMO.