18 lines
316 B
JavaScript
18 lines
316 B
JavaScript
"use strict";
|
|
|
|
import fs from 'fs';
|
|
import Database from 'better-sqlite3';
|
|
|
|
var db = null;
|
|
|
|
async function init(filename, options) {
|
|
db = new Database(filename, options);
|
|
db.exec(await fs.promises.readFile("../db_template.sql", "utf8"));
|
|
}
|
|
|
|
function get_instance() {
|
|
return db;
|
|
}
|
|
|
|
|
|
export { init, get_instance };
|