Skip to content

Commit

Permalink
Fix fallback doc
Browse files Browse the repository at this point in the history
  • Loading branch information
quolpr committed Sep 2, 2021
1 parent abf72c4 commit c6b12c9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ async function run() {
SQL.FS.mkdir('/sql');
SQL.FS.mount(sqlFS, {}, '/sql');

let db = new SQL.Database('/sql/db.sqlite', { filename: true });
const path = '/sql/db.sqlite';
if (typeof SharedArrayBuffer === 'undefined') {
let stream = SQL.FS.open(path, 'a+');
await stream.node.contents.readIfFallback();
SQL.FS.close(stream);
}

let db = new SQL.Database(path, { filename: true });
// You might want to try `PRAGMA page_size=8192;` too!
db.exec(`
PRAGMA journal_mode=MEMORY;
Expand Down

0 comments on commit c6b12c9

Please sign in to comment.