Skip to content

Commit 883fd0b

Browse files
committedJan 7, 2020
Use bindings to load the .node file
1 parent 84274da commit 883fd0b

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed
 

‎lib/database.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,7 @@ const fs = require('fs');
33
const path = require('path');
44
const util = require('./util');
55

6-
const releaseFilepath = require('path').join(__dirname, '..', 'build', 'Release', 'better_sqlite3.node');
7-
const debugFilepath = require('path').join(__dirname, '..', 'build', 'Debug', 'better_sqlite3.node');
8-
let filepath;
9-
try {
10-
fs.accessSync(releaseFilepath, fs.constants.F_OK);
11-
filepath = releaseFilepath;
12-
} catch (e) {
13-
filepath = debugFilepath;
14-
}
15-
16-
const CPPDatabase = require(filepath).Database;
6+
const CPPDatabase = require('bindings')('better_sqlite3.node').Database;
177

188
function Database(filenameGiven, options) {
199
if (filenameGiven == null) filenameGiven = '';

0 commit comments

Comments
 (0)