Skip to content

Commit

Permalink
Merge pull request #22 from quolpr/fix-doc
Browse files Browse the repository at this point in the history
Fix fallback doc
  • Loading branch information
jlongster committed Oct 13, 2021
2 parents deb5fc0 + c6b12c9 commit 5cc7dad
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 5cc7dad

Please sign in to comment.