INNER CODE UNIT · JavaScript
wrapped
m4heshd/better-sqlite3-multiple-ciphers · benchmark/benchmark.js:10
const wrapped = cb => fn().then(() => cb(), cb);
benchmark(wrapped).then(display);
};
const display = (result) => {
process.stdout.write(String(result).replace(/ \(.*/, ''));
process.exit();
};
(async () => {
process.on('unhandledRejection', (err) => { throw err; });
const ctx = JSON.parse(process.argv[2]);
const type = require(`./types/${ctx.type}`);
const db = await require('./drivers').get(ctx.driver)('../temp/benchmark.db', ctx.pragma);
if (!type.readonly) {
for (const table of ctx.tables) await db.exec(`DELETE FROM ${table} WHERE rowid > 1;`);
await db.exec('VACUUM;');
}