DemoSQLiteLinesDatabaseClient = async (source) => {
function load(source) {
return typeof source === "string"
? fetch(source).then(load)
: source instanceof Response || source instanceof Blob
? source.arrayBuffer().then(load)
: source instanceof ArrayBuffer
? new Uint8Array(source)
: source;
}
const [SQL, buffer] = await Promise.all([
sqljs({ locateFile: (filename, prefix) => wasm }),
Promise.resolve(source).then(load)
]);
return new SQLiteDatabaseClient(new SQL.Database(buffer));
}