Can SQL.js (SQLite JavaScript implementation) write to disk immediately, automaticallly? Can SQL.js (SQLite JavaScript implementation) write to disk immediately, automaticallly? sqlite sqlite

Can SQL.js (SQLite JavaScript implementation) write to disk immediately, automaticallly?


You can try Alasql JavaScript SQL library. It has Local Storage and IndexedDB adapters, where you can store data.

Current Local Storage adapter can work in AUTOCOMMIT mode, when Alasql writes every changes immediately to localStorage (see Local Storage Adapter source code).

alasql('CREATE LOCALSTORAGE DATABASE MyBase; SET AUTOCOMMIT ON; \        INSERT INTO MyBase.cite VALUES ("Paris","France")");

If you need more specific requirements, it is easy to rewrite this adapter to your needs.